Never jump straight to code
Interviewers grade the process, not only the AC.
The five beats
1. **Clarify** — inputs, outputs, constraints, nulls, duplicates, sorted?, mutability.
2. **Examples** — 1 happy path + 1 edge (empty, single, overflow).
3. **Approach** — brute force first (say complexity), then optimize. Name the pattern.
4. **Code** — narrate structure; keep functions small; name variables for the domain.
5. **Test** — walk the example; fix bugs out loud; state remaining risks.
Phrases that help
- “Constraints say n ≤ 10⁵, so O(n²) is too slow.”
- “I’ll start with a hash map so lookups are O(1).”
- “Empty input should return [] — I’ll guard that first.”
Practice
Open Two Sum in the bank. Solve it **out loud** in 20 minutes using the five beats — even if you already know the answer.