skip to content

questions

12

In a coding interview, how do you narrate a fork between two approaches before writing code?

level: juniorimportance: must knowfreq 75%

answer

  1. the interviewer is scoring the choosing
  2. two candidates out loud, not one
  3. one line of cost each, not a lecture
  4. then pick one, and say why
  5. end on a question, then stop talking

basics

~20 s

State each approach in a sentence or two, name the cost that separates them, say which one you would take and why, then ask the interviewer to confirm before you write a line of code.

solid answer

~50 s

The fork is the moment an interviewer can actually score, so make it audible in four beats. Beat one and two: name each candidate approach and the single cost that characterises it — "a direct scan, easy to get right, but it re-checks everything on every query" versus "build a lookup structure once, more memory and more code, then each check is cheap". Beat three: pick one and say what made you pick it, tying the choice to a constraint you already clarified. Beat four: check in — "I'd go with the second, shall I start there?" — and then stop talking and listen. The check-in is cheap insurance: redirecting a plan costs seconds, redirecting twenty lines of code costs the round. It also invites the interviewer to hand you a constraint they were holding back.

go deeper

for a junior

Be ready to speak two approaches before you type anything. Rehearse the four beats until they are automatic: approach A and its cost, approach B and its cost, your pick with a reason, then a direct question to the interviewer.

for a middle

Expect to justify the tradeoff rather than just name it: which resource each branch spends, and which constraint makes that resource cheap here. What is listened for is whether your pick actually follows from the costs you just stated.

for a senior

Show that the agreed plan stays live. Refer back to it while coding, and announce any deviation the moment you notice it. Quietly drifting away from a plan you committed to two minutes ago reads worse than never having planned.

for a principal

Own the framing itself. Surface the constraint that decides the fork — expected size, how often it is queried, who maintains the result — and make the interviewer a participant in the decision rather than an approver of a plan you present finished.

## Why the fork is the scoreable moment An interviewer has almost no access to your reasoning except what you say out loud. Two candidates can write the same accepted solution and be scored differently, because one of them made the *choosing* visible and the other only made the *typing* visible. In a scheduling assistant that must flag whether a newly requested booking collides with what is already on a shared calendar, there is usually more than one workable shape of solution. The interviewer already knows that. What they do not know is whether you know it, whether you can price the options, and whether you can commit to one without dithering. The fork narration is the artefact that answers all three in about ninety seconds. ## The four beats **1 and 2 — name each approach and its characteristic cost.** One or two sentences each, no more. "The direct version checks the new booking against every existing one. It is obvious, hard to get wrong, and does full work on every request." "The other version pays a setup cost once and builds an auxiliary structure, so each later check is cheap, at the price of extra memory and more code to get right." You are not lecturing; you are labelling. The cost you name should be the one that actually distinguishes them — time per query, extra memory, code you can finish in the time available, or how badly it degrades when the input grows. **3 — pick, and say why.** This beat is the one most candidates drop. Two approaches described and neither chosen reads as indecision, not thoroughness. Tie the pick to something concrete: a constraint you clarified earlier ("you said a calendar rarely holds more than a few dozen entries"), a risk ("the simpler one I can finish and test in the time we have"), or an intended path ("I'll start simple and upgrade if we care about repeated queries"). **4 — check in, once, and then stop.** "I'd go with the second — shall I start there?" Then be quiet. Silence after a question is not awkward; it is the interviewer's turn. What you get back is worth having: a confirmation, a nudge toward the other branch, or a constraint they were deliberately withholding until you asked ("assume the calendar is huge and queries are frequent"). This is why the check-in beats simply announcing your choice — an announcement invites no correction, a question does. ## Why before coding, specifically Correction is cheap in prose and expensive in code. A plan you spoke in three sentences can be redirected in one sentence. Twenty lines already typed create sunk-cost pressure on both sides: you defend them, the interviewer hesitates to make you throw them away, and you burn the middle of the session on an approach that was known to be wrong at minute six. The check-in moves the cheapest possible correction to the earliest possible moment. It also converts your plan into a shared reference. Once the interviewer has agreed to approach B, everything after that can be narrated against it: "this is the setup step we talked about", "this is where I said the memory goes". That is far less talking for far more signal than commentary invented on the fly. ## Failure modes to avoid - **Typing first, narrating after.** Post-hoc explanation cannot be redirected, and it reads as reconstruction rather than reasoning. - **Presenting one approach as if no alternative existed.** Even when you strongly prefer one, naming the one you rejected and why is nearly free and shows you searched. - **Describing both and choosing neither.** The interviewer will eventually choose for you, and you will have shown that you cannot. - **Turning the check-in into a request for the answer.** "Which one do you want me to do?" hands over the decision. "I'd take the second because X — does that match what you have in mind?" keeps it. - **Checking in constantly.** Once at the fork, and again only at genuine decision points. Permission-seeking every few lines reads as low confidence. ## When you genuinely see only one approach Say so, honestly, and price it anyway: "The only thing I see right now is the direct scan. Its weak point is that it repeats work on every request — I suspect there's something better if repeated queries matter. Shall I get the direct version correct first and then look at that?" That is a strong answer. It names the approach, names the weakness, offers a plan, and checks in. Inventing a straw second option to fill the script is worse than admitting you see one path. ## The register Two sentences per branch, not two minutes. Speak in decisions and costs, not in narration of your own mental state. "I'm thinking, hmm, maybe, well…" is not the same as "here are the two shapes, here is what each costs, here is my pick". The first is noise; the second is a plan someone else can agree to.

  • The interviewer answers your check-in with 'either is fine, you pick' — what do you do?
    Take the decision back immediately and commit out loud: "Then I'll take the direct scan, because I can get it correct and tested in the time we have, and I'll say where I'd upgrade it if queries get frequent." A neutral answer is not an invitation to keep deliberating; it usually means both branches are acceptable and the interviewer wants to see you own a choice and move.
  • How do you check in without sounding like you are asking for the answer?
    Carry the decision yourself and ask for confirmation, not for instruction. "I'd go with the second because repeated checks are cheap there — does that fit the constraints you have in mind?" states a position and a reason, so the interviewer is validating your judgment. "Which one should I do?" hands the judgment over, and the thing being scored is exactly the judgment you just gave away.
  • You are ten lines into the agreed approach and realise it will not work — what do you say?
    Say it as soon as you know, name what changed, and re-fork briefly: "I'm hitting a case my plan does not cover — a request that touches both ends of an existing entry. That pushes me toward the other approach; I'd rather switch now than patch this. Any objection?" Announcing the deviation is the signal; silently drifting away from a plan you just committed to is what reads badly.

It is a pilot reading back a clearance before turning: cheap to correct in words, expensive to correct once the aircraft is committed.

saying these in an interview costs you the question

  • Starts typing immediately and explains only at the end
  • Presents one approach as if no alternative existed
  • Describes both approaches but commits to neither
  • Turns the check-in into 'which one do you want?'
  • Asks permission every few lines instead of once at the fork
  • Spends five minutes pricing branches and never starts coding

context

open as a page

Why review a coding problem you already solved and got accepted?

level: juniorimportance: must knowfreq 55%

basics

~20 s

An accepted solution proves your approach worked, not that it was the best one available. Reviewing it surfaces the idea you never had - a better pattern, a lower complexity class - which is what practice is meant to add.

open as a page

How should you budget the phases of a 40-minute coding interview, and why set the split beforehand?

level: juniorimportance: must knowfreq 62%

basics

~20 s

Roughly 5 minutes clarifying, 10 planning, 20 coding, 5 tracing in a 40-minute slot. Fixing the split in advance gives you checkpoints, so you notice time slipping at minute 15 instead of discovering at minute 35 that it is gone.

open as a page

An interviewer offers a hint mid-solve — how do you take it, and what does resisting it signal?

level: middleimportance: must knowfreq 65%

basics

~20 s

Treat a hint as new data, not a verdict. Say it back in your own words, state what it changes about your plan and what it costs, then adjust visibly. Resisting one signals you will argue with review feedback.

open as a page

In a timed coding interview with five minutes left and untested code, do you write more or trace?

level: seniorimportance: must knowfreq 58%

basics

~20 s

Stop writing new code and trace a small concrete example through what already exists. A partial solution whose boundaries you checked yourself reads far better than an untested complete one that the interviewer has to debug for you.

open as a page

What kind of think-aloud narration can an interviewer actually score, and what is just noise?

level: middleimportance: should knowfreq 55%

basics

~20 s

Decisions are scoreable; keystrokes are not. Narrate the choices, the reasons behind them, the assumptions you are making and the risks you accept. Reading your own code aloud or voicing every passing thought produces volume without signal.

open as a page

Your practice error log over 40 problems shows boundary mistakes clustering in grid problems - what do you change?

level: middleimportance: should knowfreq 42%

basics

~20 s

A cluster is a diagnosis, not a diary entry. Take the category with the largest share, drill problems chosen specifically to provoke it, then re-read the tally two weeks later to see whether the rate fell.

open as a page

Why does understanding an editorial solution not count as having learned it?

level: middleimportance: should knowfreq 45%

basics

~20 s

Following a written solution is recognition; producing one later with nothing in front of you is recall, and only recall is what an interview measures. Read the approach paragraph, close it, and rebuild the solution from your own brute force.

open as a page

On a whiteboard with someone watching, what breaks first compared with solo untimed practice?

level: middleimportance: should knowfreq 46%

basics

~20 s

Verification breaks first. With no run button you discover you had been checking correctness by executing rather than reasoning, and the audience plus the missing undo then eat the working memory you were using to hold the plan.

open as a page

What ordered unsticking drill do you run aloud when an approach stalls mid-interview?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Run a rehearsed ladder out loud: re-work a small concrete example by hand, then solve a deliberately simplified version, then scan known technique families aloud and say why each fits or fails. Announce which rung you are on.

open as a page

Your recorded mock spent 22 of 40 minutes before the first line of code — what do you diagnose?

level: middleimportance: nice to knowfreq 30%

basics

~20 s

Twenty-two minutes before coding is not automatically a defect: check what those minutes bought. If the plan let you code in one pass, the split was earned; if you circled without committing, the fix is a cutoff, not talking less.

open as a page

A spaced re-attempt of a previously failed problem fails the same way - what does that tell you?

level: seniorimportance: nice to knowfreq 30%

basics

~20 s

A repeat failure is better information than the first: it proves your remedy missed the cause. Diagnose by where the attempt broke - naming the approach, deriving it, or coding it - then change the remedy, not the interval.

open as a page