Algorithm interview guide

The algorithms and problem-solving habits that coding interviews test, in plain English. Every solution is in TypeScript and Go, compiled and run. Every idea is animated so you can watch it work.

30 lessons147 practice problems2 to 4 weeks of study

Today

How the guide is organized

Read the families in order. Click a lesson in the map to open it once its interactive page is built; walk through the map for a one-line summary of each family.

flowchart TD
    subgraph Foundations["Foundations (read first)"]
        direction LR
        F1["01 Interview process"] --> F2["02 Big O"] --> F3["03 TypeScript and Go toolkit"]
    end
    subgraph Patterns["Core patterns on arrays and strings"]
        direction LR
        P1["04 Hash maps"] --> P2["05 Two pointers"] --> P3["06 Sliding window"] --> P4["07 Prefix sums"] --> P5["08 Binary search"]
    end
    subgraph Recursion["Recursion family"]
        direction LR
        R1["09 Sorting and divide and conquer"] --> R2["10 Recursion and the call stack"] --> R3["11 Backtracking"]
    end
    subgraph Structures["Data structures"]
        direction LR
        S1["12 Linked lists"] --> S2["13 Stacks"] --> S3["14 Queues and deques"] --> S4["15 Trees and BST"] --> S5["16 Balanced trees"] --> S6["17 Heaps"] --> S7["18 Tries"]
    end
    subgraph Graphs["Graph family"]
        direction LR
        G1["19 BFS, DFS, grids"] --> G2["20 Topological sort"] --> G3["21 Union-find"] --> G4["22 Shortest paths"]
    end
    subgraph Strategies["Strategies"]
        direction LR
        T1["23 Greedy and NP-complete"] --> T2["24 Intervals"] --> T3["25 DP 1D"] --> T4["26 DP 2D"]
    end
    subgraph Extras["Extras and wrap-up"]
        direction LR
        E1["27 Bit manipulation"] --> E2["28 k-NN and where to go next"] --> E3["29 Pattern chooser, mocks, v2 map"]
    end
    Foundations --> Patterns --> Recursion --> Structures --> Graphs --> Strategies --> Extras

Lessons and your progress

Progress counts the problems you mark Solved on each lesson page. Stars show how likely a topic is to appear in an interview.

Five habits that matter more than any single algorithm

  1. Ask first, code later. Restate the problem; ask about size, order, duplicates, and empty input.
  2. Say the slow way out loud. A correct O(n²) answer with a clear path to better beats silence.
  3. Name the pattern and say why. "The array is sorted, so I can discard from either end": a reason, not a guess.
  4. Trace before you declare victory. One normal case, one edge case, one tricky branch.
  5. State complexity with the reason. "O(n), because each index is added and removed once."

Your study plan

The plans come from the Start here lesson: about 2 to 3 focused hours a day. The 4-week plan has six study days a week and a short review on the seventh. The 3-week plan is the 4-week plan with week 1's days 2 and 3 merged, week 2's days 3 and 4 merged, and the whole last week given to dynamic programming.

Your redo log

The guide's rule: keep a log of problem · pattern · what I got wrong · date to redo, and redo each wrong problem after 3 days and again after 7 days. Patterns you keep getting wrong are your real study list.

Your progress file

Progress lives in this browser (Chrome) only. Save it to a file to back it up or move it to another computer.

How to read the animations

Every lesson uses the same inks, so a picture you learned once reads the same everywhere:

left, low, slow, write, iright, high, fast, read, jthe item being looked atfixed for nowdiscarded or skippedpart of the answera bug in a replay
  • Play, pause, step. Click a stage, then use Space to play or pause and the arrow keys to step. The scrubber jumps anywhere.
  • The code follows along. The highlighted line is the one being run. Switch TypeScript and Go at the top of any page.
  • Predict the next move. Turn it on and the stage stops at each decision until you choose.
  • Your own input. Type any input and press Run; presets include the lesson's trace-table examples, and those table rows light up as the animation runs.
  • Bug replays. Red buttons rerun a classic mistake so you can watch it fail.