All roadmaps

Essentials roadmap

One to three problems for every core pattern.

For: Know the basics, want the whole map

Arrays and Hashing

Trade memory for speed by remembering what you have already seen.

Strings

Scan, compare and rebuild text with counters, windows and pointers.

Two Pointers

Walk a sequence from both ends, or at two speeds, to avoid nested loops.

Prefix Sums

Precompute running totals so any range sum costs one subtraction.

Sliding Window

Keep a moving range valid while you slide it across the input.

Binary Search

Halve the search space each step, on sorted data or on an answer range.

Stack

Last in, first out. Use it to match pairs and undo work.

Monotonic Stack

Keep the stack ordered to find the next greater or smaller item in one pass.

Queue and Deque

First in, first out, plus a deque for sliding maximums and level-by-level work.

Linked List

Rewire pointers in place, and use fast and slow pointers to find cycles and middles.

Trees

Think recursively: solve a node from the answers for its children.

Binary Search Trees

Use the ordering invariant to search, insert and validate in O(height).

Heap / Priority Queue

Always get the smallest or largest item next without sorting everything.

Tries

Share prefixes in a tree of characters for fast prefix and dictionary lookups.

Backtracking

Build candidates step by step and undo a choice when it cannot lead to an answer.

Intervals

Sort ranges by start so overlaps can be merged, counted and scheduled.

Graphs

Traverse connected structures: islands, components, shortest hops in a grid.

1-D Dynamic Programming

Break a problem into overlapping subproblems and store each answer once.

Greedy

Take the locally best choice when it provably leads to a global best.

Topological Sort

Order tasks by their dependencies and detect cycles.

Knapsack and Subset DP

Choose items under a budget; the pattern behind coin change and partitions.

2-D Dynamic Programming

Fill a table indexed by two variables: grids, two strings, intervals.

Bit Manipulation

Work on the binary form with AND, OR, XOR and shifts.

Math and Geometry

Number tricks, modular arithmetic and coordinates.