Pick a category to browse problems. Each problem comes with a worked intuition, a step-by-step walkthrough, and reference code in JavaScript, TypeScript, Python, Java, and C++.
Disjoint-set structures: connectivity, cycles, and grouping.
Lookups, frequency maps, and the bread-and-butter of interviews.
LIFO problems: bracket matching, spans, and nearest-element queries.
Sort and sweep over ranges: merging, scheduling, and overlaps.
Hierarchical data: depth-first and breadth-first traversals.
Traversal, flood fill, and exploring connected components.
Keep the best k items on hand without sorting everything.
Slide a range over a sequence, expanding and shrinking as you go.
Pointer juggling, ordered structures, and O(1) reordering tricks.
Prefix trees for fast word and prefix lookups.
Explore choices depth-first, undoing each one when it dead-ends.
Overlapping subproblems solved once and reused.
Walk a pair of indices inward (or together) to avoid nested loops.
Halve the search space each step over sorted or monotonic data.