Foundations · lesson 3 · ~15 min

Clarify. Plan.
Code. Test.

Interviewers don't only grade the final code. They grade how you got there: did you pin down the problem, state a plan with its complexity, talk while you code, and catch your own bugs? Run the same four steps, out loud, every time. The two that candidates skip, clarify and test, are the two that lose the round.

5labs
0interview moments
0mocks you've run
interview.log: one medium, 45 min
01

The clock: four phases, one budget

A typical round is 45 minutes for one medium problem. Give each phase a slice and keep an eye on the clock. Click a phase to see what to do, what to say, and the red flags interviewers write down.

interview length
Why
In practice mocks, candidates who don't get the offer tend to spend more time coding and less time testing. They start writing early, get stuck and run out of clock. The plan step is what buys the time back.
02

Clarify: ask before you code

Interview prompts are vague on purpose. Pick the questions you would ask. Good ones fill in the spec and often change the algorithm, and weak ones burn time. Press Start planning when you think you know enough.

Scenario:

Conversation

and the spec you've pinned down

Edge-case checklist

Pick the input types in your problem and tick the cases as you mention them. These same cases become your tests in step 4.

03

Plan: brute force first, then climb

Say the obvious solution and its cost out loud, even when it's slow. It proves you understand the problem and gives you a baseline. Then look for what to remove. Click Next idea to climb the ladder.

Where speed hides: B · U · D

BottlenecksThe slowest step sets the total. Speeding up anything else doesn't change the Big-O.
Unnecessary workWork that can't change the answer, like a running sum that has gone negative.
Duplicated workComputing the same thing twice. Store it in a hash map, a prefix sum or a memo.
Before you write a line, say four things: the approach in one sentence, its time complexity, its space complexity, and “does that sound good?” Wait for the yes.
04

Code: narrate as you type

Silence is the most common communication failure. Watch the same solution typed twice: once narrated, once silent, with what the interviewer is left wondering.

two_sum.py

What you say

While coding
05

Test: find your own bug before they do

Each function below passes the given example and hides one bug. Pick test cases to dry-run, and try to catch it with as few runs as you can. Edge cases from step 2 are your best weapons. Every run shows the line-by-line trace, the way you'd do it on a whiteboard.

Bug:

pick a test to dry-run

Dry run

no test run yet
Pick a test on the left.
06

Loop Gym

Interview moments: real situations from a round, each asking what you should do next. Then use the mock timer to rehearse a full problem out loud and score yourself on the four areas interviewers use.

0in a row
–accuracy
0/0cleared

Mock timer

Pick a problem you haven't seen, start the clock and talk out loud as if someone is listening. The checklist follows the phase you are in.

00:00/ 45:00
Ready

Checklist

Score yourself

The four areas most big-tech coding rubrics use. Be honest, because the history is only for you. 1 = missing, 4 = strong.