RightInterview

Interview guide

How to talk through a coding interview problem

Interviewers grade your reasoning as much as your code. Talking through a fixed sequence keeps you calm, shows your thinking and earns partial credit even when you get stuck.

Updated October 31, 2026

In short
  • Ask 2–4 clarifying questions, then state your assumptions.
  • Say the brute force out loud before optimizing.
  • Name the key observation that makes the fast version work.
  • Test with one normal case and one edge case, then give the complexity.

The sequence

  1. 1“Before I code, I want to clarify a couple of things…” Ask about input size, duplicates, empty input, and one answer or all.
  2. 2“Let me restate the problem…” in one or two sentences.
  3. 3“The straightforward approach is…” and why it's too slow.
  4. 4“The key observation is…” and which data structure follows from it.
  5. 5“I'll code the optimized version.” Use readable names.
  6. 6“Let me walk through a small example…” saying what the variables hold.
  7. 7“The complexity is…” with the reason.

Example: Two Sum

Clarify: Is exactly one pair guaranteed? Should I return indices? Brute force: check every pair. That's correct but O(n²). Key observation: while scanning, I can store the values I've seen. For each number, I check whether its complement is already stored. Walkthrough: for [2, 7, 11, 15] and target 9, I store 2 → 0, then at 7 the complement 2 is already there, so I return [0, 1]. Checking before inserting also handles [3, 3] without reusing an index. Complexity: one pass with constant-time lookups on average, so O(n) time and O(n) space.

When the interviewer follows up

Answer the new constraint directly and show only what changes. “Since the array is sorted, I'd switch from a hash map to two pointers. Time stays O(n), and extra space drops to O(1).” Don't restart your whole explanation.

Words to avoid

  • “Obviously”, “trivial” and “just”. If it were obvious, they wouldn't ask.
  • “This is a classic LeetCode problem.”
  • Long silences. Narrate even when you're unsure: “I'm checking whether sorting helps here.”

Walk into your next interview prepared

Build an assistant from your resume and the job description, then get speakable answers in real time. Pay by the hour, no subscription.

Keep reading