All 20 patterns
Most interview problems are one of these in disguise. Learn them in order, or jump to the one you need.
See them all on one page →Show20 patterns
FOUNDATIONS
Start here. Arrays, pointers, windows, stacks and search.0 / 36 solved- 01Arrays & HashingTrade memory for instant lookups.0 of 8 problems solved
- 02Two PointersTwo indices walking toward an answer.0 of 3 problems solved
- 03Sliding WindowA range that grows and shrinks as it scans.0 of 4 problems solved
- 04Prefix SumKeep running totals, then subtract to get any range.0 of 5 problems solved
- 05StackRemember the past, answer on the way back.0 of 7 problems solved
- 06Binary SearchHalve the search space every step.0 of 9 problems solved
STRUCTURES & RECURSION
Lists, trees, heaps and trying every option.0 / 27 solved- 07Linked ListRewire pointers without losing the chain.0 of 6 problems solved
- 08DesignPair simple structures so every call is fast.0 of 4 problems solved
- 09TreesRecursion that follows the branches.0 of 11 problems solved
- 10TriesShare prefixes, find words letter by letter.0 of 3 problems solved
- 11HeapsAlways know the smallest or largest item.0 of 1 problems solved
- 12BacktrackingTry, recurse, undo.0 of 2 problems solved
ADVANCED
Graphs, dynamic programming, greedy choices, intervals, grids and bits.0 / 38 solved- 13GraphsExplore neighbours with BFS and DFS.0 of 8 problems solved
- 14Advanced GraphsCheapest paths with Dijkstra, joined groups with Union-Find.0 of 3 problems solved
- 151-D DPSolve small, remember, build up.0 of 10 problems solved
- 162-D DPFill a table cell by cell.0 of 2 problems solved
- 17GreedyTake the best move now. Never look back.0 of 2 problems solved
- 18IntervalsSort by start, then merge or split.0 of 5 problems solved
- 19Math & GeometryWalk and transform grids with simple coordinates.0 of 3 problems solved
- 20Bit ManipulationUse AND, XOR and shifts to work on single bits.0 of 5 problems solved