Data Structures & Algorithms

Thirteen patterns that cover most coding rounds. Learn to spot each one, watch the algorithm run on your own input, then code it.

Up next1.1 · Sliding window: how to spot it4 min

What you'll learn

Learning roadmap

66 lessons
1. Sliding window6 lessonsKeep a range [L, R] and move it along the array in one pass.
2. Two pointers5 lessonsWalk in from both ends of a sorted line.
3. Hash map5 lessonsRemember what you have seen so you never search again.
4. Binary search5 lessonsHalve the problem every step.
5. Stack5 lessonsPark unfinished work and resolve it later.
6. BFS / DFS5 lessonsExplore trees, grids and graphs.
7. Dynamic programming5 lessonsBuild big answers from small ones, starting with Kadane.
8. Heap / priority queue5 lessonsAlways know the best item. Top-k, merging and medians.
9. Linked list5 lessonsRewire pointers: reverse, merge, find cycles.
10. Graphs5 lessonsOrdering tasks, connected groups and shortest routes.
11. Backtracking5 lessonsTry a choice, explore, undo. Subsets, permutations, queens.
12. Intervals5 lessonsSort ranges and sweep: merge, insert, schedule.
13. Trie5 lessonsShare prefixes for autocomplete and fast lookups.