Each tier builds on the one before it. Color shows how much of each pattern you've rated Solid.
Hash maps and sets that turn pair-by-pair comparisons into one pass. The starting point for every other pattern. Leads to Two Pointers, Stack, Cyclic Sort, Bitwise XOR, Merge Intervals, Linked List, and Math & Geometry.
13 problems. Next up: Two Sum.
Hash maps and sets that turn pair-by-pair comparisons into one pass.
Two indices converge on a target across a sorted or paired sequence. Builds on Arrays & Hashing.
A dummy head and careful pointer writes for merging, removal, and copies. Builds on Arrays & Hashing.
Index formulas for matrices, digit carries, overflow checks, and fast powers. Builds on Arrays & Hashing.
The most recent unfinished item stays on top for matching and nesting. Builds on Arrays & Hashing.
Sort ranges by start, then sweep once to merge or count overlaps. Builds on Arrays & Hashing.
XOR cancels equal values, so a single pass finds the odd one out. Builds on Arrays & Hashing.
Swap each value to its own index when values fall in a known range. Builds on Arrays & Hashing.
Grow and shrink a contiguous window while tracking an aggregate. Builds on Two Pointers.
Halve a sorted or monotonic space, including the answer itself. Builds on Two Pointers.
Pointers at two speeds find cycles and midpoints in linked structures. Builds on Two Pointers and Linked List.
Rewire next pointers in place with prev, current, and next. Builds on Two Pointers and Linked List.
A stack or deque kept in order answers next greater and next smaller. Builds on Stack.
Recursive or stack-based traversal in pre, in, or post order. Builds on Stack.
Take the locally best choice when it provably leads to the global best. Builds on Merge Intervals.
A heap of size k tracks the k largest, smallest, or most frequent. Builds on Tree DFS.
A tree keyed by characters for prefix lookups in O(length). Builds on Tree DFS.
Level-order traversal with a queue, one level at a time. Builds on Tree DFS.
Build subsets, permutations, and combinations by extending prior results. Builds on Tree DFS.
Solve each state once from smaller states over a sequence or grid. Builds on Tree DFS.
A max-heap and a min-heap split a stream to track its median. Builds on Top K Elements.
A min-heap of list heads merges k sorted sources in O(N log k). Builds on Top K Elements.
Explore a graph by levels or branches with a visited set. Builds on Tree BFS.
Search a decision tree, undoing each choice that fails. Builds on Subsets (BFS-style generation).
Take or skip each item under a capacity, tabulated by item and budget. Builds on Subsets (BFS-style generation) and Dynamic Programming (1-D & 2-D).
Order a DAG so every edge points forward, by in-degree or post-order. Builds on Graph BFS/DFS.
Disjoint sets with path compression answer connectivity in near O(1). Builds on Graph BFS/DFS.