When it's real

Interview

Got a date?

Make a plan in a minute

Tell us the companies and the day. We size a day-by-day plan to it and track your pace. No date yet? Start with the path; this page will be here when you need it.

Make my plan →

The guide

How to ace the coding interview

Solving the problem is only part of it. Interviewers watch how you clarify, reason, write code and check your work. Here's how to learn so it sticks, and exactly what to do and say in the room.

Before the interview

How to learn so it sticks

  1. 1.Learn patterns, not answers

    Each problem is practice for a pattern (two pointers, sliding window, BFS…). After solving, name the pattern and the clue in the problem that pointed to it.

  2. 2.Time-box the attempt

    Give it 20–30 minutes. If you're stuck, read only the idea, not the code, then close it and write the code yourself.

  3. 3.Write a 3-line note

    Pattern, key insight, the bug you hit. Reading these notes before an interview beats re-reading whole solutions.

  4. 4.Re-solve from memory

    Solve it again after 1 day, 1 week and 1 month. If you can't, it wasn't learned yet. That's what Reviews is for.

    Open reviews →
  5. 5.Practise like the real thing

    Sometimes use a plain editor with no autocomplete, a 45-minute timer, and explain out loud as if someone is listening.

In the room

The 45-minute plan

A typical coding round, step by step, with what to do and an example of what to say. The example is Two Sum.

  1. 0–5 minClarify

    Restate the problem in your own words. Ask about input size, value ranges, duplicates, negatives, empty input and what to return.

    “So I get an unsorted array of integers and a target, and I return the indices of two numbers that add up to it. Can there be more than one answer? Can I use the same element twice?”

  2. 5–10 minExamples and edge cases

    Work one normal example by hand, then list edge cases. Agree on them before coding.

    “Let me try [2, 7, 11, 15] with target 9: that's 0 and 1. Edge cases I'll keep in mind: two elements, negative numbers, duplicates like [3, 3].”

  3. 10–15 minBrute force first

    State the simplest correct idea and its complexity. Don't code it unless asked, but it proves you understand the problem.

    “The brute force checks every pair: O(n²) time, O(1) space. That works but is slow for large n. Can I do better?”

  4. 15–20 minOptimize and agree

    Find the repeated work and remove it, usually with a better data structure. Get the interviewer's OK before you write code.

    “The slow part is searching for the partner each time. If I store each number's index in a hash map, I can look up target − x in O(1). That's O(n) time and O(n) space. Does that sound good?”

  5. 20–35 minCode it, talking as you go

    Write clean code with clear names. Explain each block briefly as you write it, not after.

    “I'll loop with the index. For each number I compute what I need. If it's already in the map, I return both indices; otherwise I store this one.”

  6. 35–42 minTest it yourself

    Dry-run your code line by line on the example, then on an edge case. Fix bugs calmly and say what you changed.

    “Running [3, 3], target 6: first 3 isn't in the map, I store it. Second 3 needs 3, which is there, so I return 0 and 1. Good.”

  7. 42–45 minWrap up

    Restate final complexity and mention a trade-off or extension. Then ask your own questions.

    “Final: O(n) time, O(n) space. If memory were tight and the array sorted, two pointers would give O(1) space.”

Practice it against the clockA 45-minute mock on a problem you haven't seen, stage by stage.Start a mock →

In the room

Writing code they can follow

  • →Use names that say what things are: left, right, windowSum, seen, not i2 or tmp.
  • →Pull messy parts into a small helper function, and name it for what it does.
  • →Handle edge cases at the top (empty input, single element) so the main logic stays clean.
  • →Write the straightforward version first. Micro-optimizations can wait until it's correct.
  • →Don't go silent while typing. Short narration is enough: “now I shrink the window”.
  • →Know your language's basics cold: sorting, hash maps, heaps, deque, string building.

In the room

Explaining your approach

Use the same four parts every time. It keeps you organized under pressure and makes you easy to follow.

1

Idea

One or two sentences: the pattern and the key insight.

2

Why it works

The reason it's correct: what stays true at every step (the invariant).

3

Complexity

Time and space, with a reason for each, not just the letters.

4

Trade-offs

What you gave up (usually memory) and when another approach would be better.

Example: Longest Substring Without Repeating Characters

Idea
“A sliding window. I grow the right edge, and when a character repeats, I move the left edge past its last position.”
Why it works
“The window never contains a duplicate, and every possible substring end is checked once, so I can't miss the longest one.”
Complexity
“O(n) time, because each edge only moves forward. O(k) space for the last-seen map, where k is the alphabet size.”
Trade-offs
“A brute force over all substrings is O(n²) or worse but needs no map. For lowercase letters only, a fixed array of 26 replaces the map.”

In the room

When you're stuck

  • →Say what you're thinking, even half-formed. The interviewer can only help if they hear it.
  • →Go back to a small example and solve it by hand. Watch what your brain does.
  • →Ask: would sorting help? A hash map? Two pointers? A heap? Binary search on the answer?
  • →Solve a simpler version first (no duplicates, sorted input), then extend it.
  • →If they give a hint, take it and build on it. Using hints well is a good signal, not a failure.

Avoid

Common mistakes

  • –Coding before clarifying the problem, then solving the wrong one.
  • –Jumping to an “optimal” idea you can't explain or finish.
  • –Long silences while thinking.
  • –Saying “done” without testing.
  • –Arguing with a hint instead of exploring it.
  • –Stating complexity without explaining it.

Behind the scenes

How you're scored

Most companies use a version of these four areas. A correct answer with poor communication can score lower than a near-miss that was clearly reasoned and tested.

Problem solving

Did you understand the problem, find a good approach and justify it?

Coding

Is the code correct, readable and reasonably structured?

Communication

Could they follow your thinking? Did you listen to and use their input?

Verification

Did you test your own code and find your own bugs?

Ready to practise?

Pick the company you're interviewing with, or follow the roadmap level by level.