Classic algorithm problems
Classic algorithm problems are compact stress tests for a technique. Each lesson takes a familiar problem — many known from LeetCode — and turns its solution into a trace you can inspect. You see every lookup, pointer move, and early return beside the line that caused it, which is much harder to fake than memorizing the final loop.
These lessons slow down the part a short solution usually hides: the invariant that makes it correct. Two Sum checks before inserting so one index cannot be reused. LRU Cache makes a hash map and a doubly linked list maintain the same entries while answering different questions in expected O(1) time. Trapping Rain Water proves why the smaller running boundary can finalize one column. 3Sum sorts once, then shows why fixing an anchor turns the search into a two-pointer sweep and why skipping an equal neighbor is all the duplicate handling it needs.
A natural order: start with Two Sum for the hash-lookup idea, take the Two Pointers lesson from the search category if you have not, then 3Sum to see the sweep applied per anchor, and Trapping Rain Water for the boundary-proof variant. LRU Cache stands apart as a data-structure composition problem.
How to use these lessons
Run the default example once, then pause before the decisive step and predict the next state. Change one input afterward: pick a target with no valid pair, update an existing cache entry, or reshape a basin so it cannot hold water. The boundary path is where an implementation's real assumptions become visible.
All classic algorithm problems
Open a lesson below to manipulate its inputs, follow the synchronized code, and test your understanding with trace-derived questions.