Algorhythm — Train the pattern. Practice on LeetCode.<br>Train the pattern here.<br>Practice on LeetCode.<br>We are not another problem archive. We compress the gap between I read the problem and I see the trick from hours into minutes — with interactive animations that teach the mental model, not the syntax.
family · 3 sub-patterns<br>Two Pointers<br>Two indices moving over the same sequence to maintain an invariant — converging, fast/slow, sliding window.
converging · fast-slow · sliding
single<br>Binary Search Variants<br>Boundary conditions are the field's largest unsolved teaching problem.
3 variants · O(log n)
single<br>Backtracking<br>Decision-tree expansion — uniquely suited to animation.
branching state machine
single<br>Monotonic Stack<br>Stack-state transitions are invisible in code, dramatic in animation. The stack is the protagonist.
next-greater · histogram
phase 2<br>BFS / DFS on Gr DFS<br>A queue gives breadth, a stack gives depth — same algorithm, two traversal orders.
queue · stack · flood fill
phase 2<br>Heap & Priority Queue<br>Track the k most extreme — the root of a min-heap of size k is the worst of the k.
top-k · merge-k · O(N log k)
phase 2<br>Tree Traversal<br>Every traversal visits every node once — only when relative to children's recursion differs.
preorder · inorder · postorder · level
phase 2<br>Linked List Manipulation<br>Three pointers — prev, curr, next — let you rewrite a list in place without losing the tail.
reverse · merge · reorder
family · 5 sub-patterns<br>Dynamic Programming<br>A table fills itself, one cell at a time — each entry composed from a constant number of earlier ones. A family of five sub-patterns.
1-d · 2-d · knapsack · interval · state-machine
single · phase 3<br>Union Find<br>Maintain a partition of N elements into disjoint components — merge two components in near-constant time, with the forest flattening itself on every query.
connected components · O(α(N))
single · phase 3<br>Trie<br>Store a set of strings on a tree of characters — words that share a prefix share a path, and a single 'end-of-word' flag separates stored words from in-flight prefixes.
prefix queries · autocomplete · word-search
single · phase 3<br>Topological Sort<br>Linearize a directed acyclic graph so every edge points left-to-right — each node enters the order only after every prerequisite has already left.
Kahn's algorithm · O(V + E) · cycle detection
family · 4 sub-patterns<br>Prefix Sum<br>Pay O(N) once to amortize every range query to O(1) — and flip it inside-out for cheap range updates. A family of four sub-patterns.
1-d · 2-d · difference · hash-map
family · 4 sub-patterns<br>Shortest Path<br>Find the shortest route from a source — the mechanism splits by what the edges carry. BFS for uniform costs, Dijkstra for non-negative, Bellman-Ford for negatives, Floyd-Warshall for all pairs.
BFS · Dijkstra · Bellman-Ford · Floyd-Warshall
single<br>Merge Intervals<br>Sort by start, then sweep — each interval either extends the current merge or commits it and starts a new one. The whole pattern lives in that one comparison.
sort + linear sweep · O(N log N)