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 window 6 lessonsKeep a range [L, R] and move it along the array in one pass.
2. Two pointers 5 lessonsWalk in from both ends of a sorted line.
3. Hash map 5 lessonsRemember what you have seen so you never search again.
4. Binary search 5 lessonsHalve the problem every step.
5. Stack 5 lessonsPark unfinished work and resolve it later.
6. BFS / DFS 5 lessonsExplore trees, grids and graphs.
7. Dynamic programming 5 lessonsBuild big answers from small ones, starting with Kadane.
8. Heap / priority queue 5 lessonsAlways know the best item. Top-k, merging and medians.
9. Linked list 5 lessonsRewire pointers: reverse, merge, find cycles.
10. Graphs 5 lessonsOrdering tasks, connected groups and shortest routes.
11. Backtracking 5 lessonsTry a choice, explore, undo. Subsets, permutations, queens.
12. Intervals 5 lessonsSort ranges and sweep: merge, insert, schedule.
13. Trie 5 lessonsShare prefixes for autocomplete and fast lookups.