Reading material
Saved locallyShort, focused primers on the patterns behind the problems. Read one, then go solve something that uses it.
Arrays & Hashing
Indexing, hash maps, and frequency counting.
Strings
Frequency maps, in-place pointer tricks, efficient building.
Sorting
Comparators, linear-time counting sorts, and Quickselect.
Stacks & Queues
LIFO/FIFO and the monotonic stack pattern.
Linked Lists
Pointer surgery, fast/slow pointers, reversal, dummy heads.
Trees & Traversals
DFS orders, BFS by level, and the BST invariant.
Graphs
Modeling, DFS/BFS, components, and topological sort.
Simulation & Enumeration
Modeling a process directly — cleanly and correctly.
Two Pointers
Converging and chasing pointers that turn O(n^2) into O(n).
Sliding Window
A moving window for subarray/substring questions.
Prefix Sums & Difference Arrays
Cumulative totals for O(1) range queries and subarray counts.
Binary Search
Halve the search space — on arrays and monotonic answers.
Tries (Prefix Trees)
A character-keyed tree for fast prefix and word lookups.
Heaps & Priority Queues
Top-K, merging, and scheduling with always-on min/max access.
Ordered Sets
Keep data sorted as it changes — neighbor and rank queries.
Backtracking
Build candidates incrementally and undo choices.
Union–Find (DSU)
Near-O(1) merging and connectivity — components, cycles.
1-D Dynamic Programming
Overlapping subproblems on a line — memoization & tabulation.
Greedy
Locally optimal choices that give a global optimum.
Intervals
Sort by an endpoint, then sweep — merge, insert, count overlaps.
Math & Geometry
Matrix manipulation, number theory, and arithmetic tricks.
Bit Manipulation
XOR tricks, masks, and counting bits for O(1)-space wins.
String Matching & Hashing
Find patterns fast — KMP and rolling hashes.
Divide & Conquer
Split, solve halves, combine — and reason about cost.
Design (Data Structures)
Compose maps, heaps, and lists to hit required time bounds.
Randomized Algorithms
Uniform sampling, fair shuffles, expected-time selection.
Game Theory
Two-player optimal play — minimax, winning states, Nim.
Advanced Graphs
Weighted shortest paths, MSTs, and Bellman-Ford.
2-D Dynamic Programming
Grids and two-sequence problems needing two dimensions.
Segment & Fenwick Trees
Logarithmic range queries with point/range updates.