learn by tracing

Algorithms

34 algorithms · 14 categories

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++.

1 problem
Union–Find

Disjoint-set structures: connectivity, cycles, and grouping.

browse →
5 problems
Arrays & Hashing

Lookups, frequency maps, and the bread-and-butter of interviews.

browse →
1 problem
Stack

LIFO problems: bracket matching, spans, and nearest-element queries.

browse →
2 problems
Intervals

Sort and sweep over ranges: merging, scheduling, and overlaps.

browse →
3 problems
Trees

Hierarchical data: depth-first and breadth-first traversals.

browse →
4 problems
Graphs

Traversal, flood fill, and exploring connected components.

browse →
1 problem
Heap / Priority Queue

Keep the best k items on hand without sorting everything.

browse →
2 problems
Sliding Window

Slide a range over a sequence, expanding and shrinking as you go.

browse →
2 problems
Linked List

Pointer juggling, ordered structures, and O(1) reordering tricks.

browse →
1 problem
Tries

Prefix trees for fast word and prefix lookups.

browse →
3 problems
Backtracking

Explore choices depth-first, undoing each one when it dead-ends.

browse →
5 problems
Dynamic Programming

Overlapping subproblems solved once and reused.

browse →
3 problems
Two Pointers

Walk a pair of indices inward (or together) to avoid nested loops.

browse →
1 problem
Binary Search

Halve the search space each step over sorted or monotonic data.

browse →