How Coding Interviews Work
On this page
Plenty of good engineers leave a coding round knowing they solved the problem and still get a "no". Usually the code was fine. What went wrong was everything around it: they started typing before they understood the question, went quiet for ten minutes, or never tested what they wrote. This page explains what the round actually measures and how to use the rest of this track to prepare for it.
How it works
The round, minute by minute

A typical round is 45 minutes with one interviewer, in a shared editor or on a whiteboard. Timings vary by company and level, so treat these as a common shape rather than a rule:
- Intro (about 5 minutes). A short hello. Keep your background to two or three sentences.
- Understand the problem (about 7 minutes). You read or hear a prompt, ask questions, and work an example by hand.
- Approach (about 8 minutes). You describe a first solution and its cost, then improve it. Most interviewers want to agree on the plan before you code.
- Code (about 15 minutes). You write a clean, working solution while explaining what you are doing.
- Test and follow-ups (about 7 minutes). You trace your code on an example, fix bugs, and answer "what if" questions.
- Your questions (about 3 minutes).
Many loops ask two problems in one round, or one problem with a harder follow-up. If you finish early, expect more.
What you are scored on
Interviewers usually write feedback under four headings. The names differ between companies, but the substance is the same:
| Area | What a strong signal looks like |
|---|---|
| Problem solving | You find a correct approach, compare options, and land on a good time and space cost without heavy hints. |
| Coding | Clean, readable code with sensible names, in a language you know well. Few syntax slips. |
| Verification | You test without being asked, find your own bugs, and think about edge cases. |
| Communication | The interviewer always knows what you are doing and why. You take hints well. |
Notice that only one of the four is about typing code. A candidate who reaches the optimal answer in silence can score lower than one who reaches a slightly slower answer while explaining every step clearly.
The six steps

- Clarify. Repeat the problem in your own words. Ask about input size, value ranges, duplicates, empty input and what to return when there is no answer.
- Example. Work one small example by hand, ideally one that is not trivial. This catches misunderstandings before they cost you twenty minutes.
- Brute force. Say the simplest correct idea and its complexity, even if it is slow. It proves you understand the problem and gives you something to improve.
- Optimize. Ask what work the brute force repeats, and which pattern removes it: a hash map, two pointers, a heap, sorting, and so on. State the new time and space cost.
- Code. Write it in small, named pieces. Say what each block does as you write it.
- Test. Trace your code on the example line by line, then on the edge cases you listed in step 1.
Trade-offs and costs
The six steps feel slow the first time. The trade is worth it:
- Clarifying costs a minute; a wrong assumption costs the round. Interviewers often hide a detail in the prompt (sorted input, negative numbers, duplicates) to see whether you ask.
- Saying the brute force costs thirty seconds and guarantees you have a working fallback if you get stuck optimizing.
- Talking while coding slows you down a little, but it lets the interviewer give you a hint the moment you head the wrong way, which saves far more time than it costs.
When to reach for it
Use the six steps on every problem, including ones you have seen before. If you recognize a problem, still clarify and still mention the brute force briefly; interviewers can tell when a candidate jumps straight to a memorized answer, and many change a detail on purpose to check.
Example
Suppose the prompt is: "Given a list of numbers and a target, return the positions of two numbers that add up to the target."
- Clarify: "Is there always exactly one answer? Can I use the same element twice? Is the list sorted? How large can it be?"
- Example:
[3, 8, 1, 5], target 9: 8 + 1 = 9, so the answer is positions 1 and 2. - Brute force: "Check every pair: O(n²) time, O(1) space."
- Optimize: "For each number I need its partner, target minus the number. If I remember every number I've seen in a hash map, I can check for the partner in O(1). That's O(n) time and O(n) space."
- Code, then test on the example and on a case with no answer.
That is the whole round in miniature. The full walkthrough is in Two Sum.
How to use this track

- Data structures (10 articles): what each structure is fast and slow at. Read these first if your basics are rusty.
- Patterns (16 articles): the ideas that turn a brute force into a good answer, with the signals that tell you which one to try.
- Problems (125): grouped by pattern and ordered from easy to hard inside each group. Each one has the same layout: the prompt, an approach ladder from weak to strong, code in Python, Java, C++ and Go, the common bug, and follow-ups.
- Before interview: a checklist and a one-page pattern cheat sheet for the night before.
A practical plan: read a pattern article, try its first two problems on your own before opening the solution, then read the walkthrough and compare. Come back a few days later and solve them again from a blank editor. Recognizing a pattern quickly matters more than the number of problems you have seen.
Common mistakes
- Coding before agreeing on the approach. If the interviewer doesn't know your plan, they can't help when it goes wrong.
- Going silent. Ten quiet minutes look the same as being stuck, even if you are not.
- Skipping the brute force. If you then get stuck on the optimal idea, you have nothing on the board.
- Not testing. "I think it works" is weaker than tracing the example and catching your own off-by-one.
- Arguing with hints. A hint is the interviewer trying to help you pass. Take it, say thanks, and use it.
- Using an unfamiliar language. Pick the one you write most fluently; interviewers rarely care which.
Say this in the interview
- "Let me repeat the problem to make sure I have it right…"
- "Before I optimize, the simplest correct approach is …, which is O(n²). Let me see what work it repeats."
- "I'm going to use a hash map from value to index, so each lookup is O(1). Does that sound reasonable before I code it?"
- "Let me trace this on the example… and now the empty input and the case with no answer."
Used in
Every article in the Coding track follows this flow. Next, read Big-O for Interviews, then start the data structures with Arrays and Strings and Hash Maps.