CMD Guide
HomeCareer & Job SearchInterviews

The Coding Interview — A Repeatable 6-Phase Method

A repeatable method beats raw problem-solving nerves

The coding interview grades four things — problem-solving, coding, communication, and testing — and three of them are lost if you solve silently or jump straight to code. Run the same six phases every time so the structure carries you when the problem is hard.

Six-phase coding interview loop: clarify, examples, brute force, optimize, code, test
Six-phase coding interview loop: clarify, examples, brute force, optimize, code, test

The six phases, traced

  1. Clarify — restate the problem; ask about input size, types, duplicates, empty/negative, sorted? Confirm the expected output. (Catches the wrong-problem disaster.)
  2. Examples — write 1–2 concrete cases incl. an edge case; they double as your tests.
  3. Brute force — state the obvious solution and its Big-O out loud. You now have a baseline and a correctness reference.
  4. Optimize — identify the pattern (two pointers? sliding window? hash map? binary search? — see DSA Pattern Recognition), explain the new complexity before coding.
  5. Code — write clean, named code; narrate as you go ("now I'll handle the empty case").
  6. Test — dry-run your example line by line; check the edges you listed. Find your own bug before they do.

How to use it for practice

Don't just solve problems — solve them out loud, on a timer, in these phases (record yourself, or use the spaced-repetition deck for the patterns). The skill being trained is the narration, not just the answer.

Pitfalls

Takeaways


Re-authored for this guide; phase diagram hand-authored as SVG. Follows the Tech Interview Handbook (yangshun). See also: DSA Pattern Recognition, and the spaced-repetition review deck.

🤖 Don't fully get this? Learn it with Claude

Stuck on The Coding Interview — A Repeatable 6-Phase Method? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **The Coding Interview — A Repeatable 6-Phase Method** (Career & Job Search) and want to truly understand it. Explain The Coding Interview — A Repeatable 6-Phase Method from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **The Coding Interview — A Repeatable 6-Phase Method** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **The Coding Interview — A Repeatable 6-Phase Method** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **The Coding Interview — A Repeatable 6-Phase Method** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes