Interview sequences

Curated orders for working through the patterns and solved problems before a coding interview. They suggest a pace; they do not time you, score you or judge your code. The goal is to recognise a pattern, explain an approach and justify its cost, which no timer can measure.

A routine for every problem

  1. Read the statement and restate it in your own words, including the input limits.
  2. Describe a brute force and its cost before improving it. Interviewers want to hear both.
  3. Name the pattern you think applies and the signal that suggested it; open the pattern page if you are unsure.
  4. Reveal hints one at a time only when stuck, then write the solution in the language you will interview in.
  5. Test the edge cases from the problem page by hand: empty input, one element, duplicates, extremes.
  6. State time and extra space, and say why. Then compare with the written solution and its correctness argument.
  7. Explain the solution out loud as if to an interviewer. If the explanation stalls, that is the part to revisit.

2 weeks · 10 sessions

Two-week refresher

For developers who learned these topics before and need them fresh: the most common array, hashing, stack, search and DP patterns, one focused session at a time.

Ten sessions, roughly one per working day. Skip what you can already explain; repeat what you cannot.

Week 1: arrays, hashing and pointers

Get fluent at turning a nested-loop idea into a single pass, and at stating why it is correct.

  1. Session 1Hashing for lookup

    Say the brute force out loud first, then remove its inner loop with a map or set.

  2. Session 2Two pointers

    For each pointer move, say which candidates it rules out and why none of them was the answer.

  3. Session 3Harder pointer moves

    Partitioning and the container problem need a sharper argument for which side to move.

  4. Session 4Sliding window

    Name the window invariant, then decide when to record the answer: after shrinking (longest) or while shrinking (shortest).

  5. Session 5Prefix sums

    Explain why the window fails with negative values and how a map of prefix sums fixes it.

Week 2: search, stacks, DP and review

Cover the remaining common shapes and practise explaining complexity without prompting.

  1. Session 1Binary search on boundaries

    Write the invariant before the loop; check the two-element case by hand.

  2. Session 2Stacks

    Matching brackets, then the monotonic stack: say what each popped element learns.

  3. Session 3One-pass scans

    Identify the smallest summary of the past that still decides the current element.

  4. Session 4Dynamic programming

    State the subproblem in one sentence, then the transition, then the base cases, then reduce the space.

  5. Session 5Review and traversal

    Re-solve any problem from the plan you struggled with, then read the BFS and DFS patterns for follow-up questions.

4 weeks · 17 sessions

Four-week foundation

A slower plan that rebuilds the underlying structures as well as the patterns, including trees, heaps and graphs, with time to revisit each week.

Four or five sessions a week. Each week ends with a review session; move on when you can explain the week's patterns without notes.

Week 1: cost, arrays and hashing

Be able to estimate the cost of any loop and to use a hash map as the default first improvement.

  1. Session 1Counting cost

    Work through the exercises until you can predict the growth before checking the answer.

  2. Session 2Arrays in practice

    In-place updates and rotations: track exactly which indices each step touches.

  3. Session 3Hash maps and sets

    Decide what the key is and what the value stores before writing code.

  4. Session 4Week 1 review

    Re-solve two problems from this week without looking, then explain their complexity aloud.

Week 2: pointers, windows, prefix sums and search

Recognise the four array patterns from the problem statement alone.

  1. Session 1Two pointers

    Opposite ends and read/write pointers; argue each move.

  2. Session 2Sliding window

    Fixed then variable windows; note when the pattern does not apply.

  3. Session 3Prefix sums

    Range sums and counting subarrays with a map.

  4. Session 4Binary search

    Lower bound, first true of a predicate, and searching an answer space.

  5. Session 5Week 2 review

    Pick three problems from weeks 1 and 2 and solve them in a different language than before.

Week 3: stacks, trees, heaps and graphs

Understand the structures interview follow-ups assume, even where this lab has no solved problem yet.

  1. Session 1Stacks and queues

    LIFO for nesting, FIFO for breadth; then the monotonic stack.

  2. Session 2Tree traversal

    Step through all four traversal orders and say which data structure drives each.

  3. Session 3Heaps and top K

    Why a min-heap of size k keeps the k largest; how your language's default heap is ordered.

  4. Session 4Graphs

    Representations, then ordering and connectivity: know when each of BFS, topological sort and union-find applies.

Week 4: greedy, DP and full review

Handle optimisation questions and finish with mixed practice.

  1. Session 1Greedy and intervals

    For each greedy rule, try to break it with a three-item example before trusting it.

  2. Session 2Dynamic programming

    Memoise the recursion first, then convert it to a table, then shrink the table.

  3. Session 3Mixed practice

    Solve problems without being told the pattern: read the constraints and name the technique first.

  4. Session 4Final review

    Walk the pattern library and, for each pattern, say one signal that suggests it and one case where it fails.