24 Final Review and Interview Checklist
The twenty problems are valuable because they compress into a smaller pattern vocabulary. Use this page for retrieval practice, not as a substitute for solving.
24.1 Pattern trigger sheet
| Signal in the prompt | First pattern to consider | Examples |
|---|---|---|
| “pair,” quick membership, counts | hash map/set | Two Sum, Group Anagrams |
| contiguous range with a validity rule | sliding window | Longest Substring |
| nested matching | stack | Valid Parentheses |
| sorted or monotonic search space | binary search | Binary Search, Rotated Search |
| sorted pairs/triples, inward movement | two pointers | Three Sum |
| overlapping ranges | sort + scan | Merge Intervals |
top/bottom k |
bounded heap | Top K Words |
| best contiguous total | local DP state | Maximum Subarray |
| “all except current” | prefix/suffix | Product Except Self |
| pointer chain | save next / fast-slow / sentinel | linked-list trio |
| visit by depth or shortest unweighted steps | BFS queue | Level Order, Islands |
| recursive subtree facts | DFS/postorder | Validate BST, LCA |
| dependencies / ordering | topological sort | Course Schedule |
| minimum choices to reach a numeric state | DP | Coin Change |
24.2 The 90-second pre-code checklist
- Restate inputs, output, and one example.
- Ask about empty input, duplicates, ordering, mutation, and numeric range if relevant.
- Name the baseline and its complexity.
- State the chosen data structure and what it stores.
- State the invariant in one sentence.
- Predict target time and space.
24.3 The 90-second post-code checklist
- Trace the smallest nontrivial example by hand.
- Test empty/single input if allowed.
- Test the main seam: duplicate, zero, boundary, skew, cycle, or unreachable state.
- Check every loop boundary and pointer update for progress.
- Check integer overflow in midpoint, comparator, sum, and product expressions.
- State whether input is mutated and whether output storage is excluded from space.
24.4 Closed-book prompts
Answer these without code:
- Why must Two Sum look up before inserting?
- Why does sorting make it safe to emit a nonoverlapping interval?
- Why does Longest Substring take the maximum when moving
start? - What exactly is on the Valid Parentheses stack?
- Which binary-search interval convention does your chosen language solution use, and what makes it empty?
- Where are duplicates skipped in Three Sum, and why in both places?
- What makes a valid anagram key canonical?
- Which word belongs at the Top K heap root?
- What does Kadane’s
endingHeremean? - What is in
answer[i]after the first Product Except Self pass? - How do you identify the sorted half of a rotated array?
- Which pointer must be saved before reversing a link?
- Why must fast and slow meet in a cycle?
- What special case does a sentinel remove?
- Why snapshot queue size for tree levels?
- Why are immediate parent/child comparisons insufficient for a BST?
- What do non-null LCA recursive returns mean?
- When should an island cell be marked visited?
- What does indegree mean during Kahn’s algorithm?
- What does
fewest[x]mean, exactly?
If any answer takes longer than 20 seconds, revisit that chapter’s invariant before retyping its solution.
24.5 A mock-interview scorecard
Score each dimension from 0–2 after a timed attempt:
| Dimension | 0 | 1 | 2 |
|---|---|---|---|
| Clarification | misses contract | asks some useful questions | resolves all code-changing ambiguity |
| Approach | no viable plan | viable but poorly justified | baseline + chosen pattern + trade-off |
| Correctness | major flaws | minor repair needed | correct with clear invariant |
| Code | incomplete/confusing | works with friction | minimal, readable, recoverable |
| Tests | none/random | normal case only | boundary + adversarial seam |
| Complexity | missing/wrong | partly correct | precise time and space |
| Communication | mostly silent | intermittent | concise continuous checkpoints |
A score below 10/14 suggests another closed-book attempt will pay off more than reading a new solution.