SproutStackSproutStack home

How Coding Interviews Work

5 min readBeginner-friendlyFree to read

Read a little, play a little. No scary maths, and no rush.

Share:

What the interviewer is actually grading

Here's the secret that changes everything: coding interviews don't measure whether you can solve the problem. They measure whether you'd be good to work with on a hard problem. The scorecard looks something like: Did they clarify ambiguity? Did they start simple instead of freezing? Did they improve the solution? Did they test it? Did they communicate? "Correct optimal code in silence" scores lower than "good code with great communication" at almost every company.

The 45-minute game plan

  • Clarify (5 min): How big is n? Negatives? Sorted? Duplicates? Ask for an example and solve it by hand together. This prevents building the wrong thing — the most expensive mistake.
  • Brute force (5 min): state the dumb solution aloud with its complexity ("that's O(n²), I can do better with a map"). A brute force on the board early proves momentum.
  • Optimize + code (20 min): name the pattern, write clean code, narrate as you go.
  • Test (5 min): dry-run an edge case line by line, then state time and space complexity out loud.

A worked example: the first ten minutes

The prompt: "Given an array of numbers and a target, return the two numbers that add up to the target."

Clarify. Before writing anything, ask: Is the array sorted? Can it contain duplicates or negatives? Is there always exactly one answer? Should I return the numbers or their positions? Suppose the interviewer says: unsorted, may contain negatives, exactly one answer, return positions.

Example by hand. For [2, 7, 11, 15] and target 9, the answer is positions 0 and 1, because 2 + 7 = 9. Walking through it out loud confirms you both mean the same thing.

Brute force. "I can check every pair with two loops. That is O(n²) time and O(1) space." Saying this takes 30 seconds and shows you can always produce something correct.

Optimize. "For each number, the partner I need is target minus that number. If I store numbers I have already seen in a hash map, I can check for the partner in O(1). That makes it O(n) time, at the cost of O(n) space." Now you code, with a plan both of you agree on.

The silence tax

Talking while thinking feels awkward and scores enormously. Narrate your confusion too: "Hmm, the duplicate case breaks this — let me think about what extra state I'd need." Interviewers can only grade what they hear; silence reads as stuck even when your brain is racing.

Talk while you think. Silence fails even with correct code.

Formats you will meet

  • Online assessment: a timed set of problems graded automatically by hidden tests. No one hears you, so correctness and edge cases carry everything.
  • Phone or video screen: one or two problems in a shared editor with an interviewer watching. Communication starts to count here.
  • Onsite or final loop: several rounds in a day, usually coding plus system design and a behavioral conversation.
  • Take-home project: a small build over a few days, judged on code quality and tests as much as on whether it works.

When you get stuck mid-interview

Being stuck is expected; how you handle it is graded. Say what you know so far and where exactly it breaks. Try a smaller input by hand. If you are still stuck after a few minutes, ask a focused question such as "Would it help to think about this in sorted order?" Taking a hint and running with it is a strong signal, not a failure.

Remember this

  • Clarify → brute → optimize → test. Every round, every time.
  • Communication is scored, not just code. Make your thinking audible.

Check your understanding

5 questions · first-try answers earn the most XP

1. What is a good first five minutes of a coding interview?
2. Why is stating a brute-force solution early useful?
3. Why does the chapter call silence a "silence tax"?
4. Which is scored more heavily: correct optimal code in silence, or slightly worse code that is narrated and tested?
5. What should you do in the final minutes of a coding round?

My notes

Saved in this browser. Highlight a line above and save it, or write it in your own words.

Nothing saved yet. Your highlights will live here.

References

Finished reading?

Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.

Related chapters

Spotted a mistake or want a topic covered? Report an issue

📬 An occasional email when new lessons land

New lessons and showdowns, no more than a few times a month. No spam, unsubscribe anytime. We store your email only to send the newsletter.