interview playbook · the clock
The 45-minute plan
A plan means you are never sitting in silence wondering what to do next.
These minutes are a guide, not a law. If intros eat 5 minutes, shrink every phase a little. Never drop testing.
01
Seven phases, 45 minutes
This is the UMPIRE budget from the mindset chapter, split one level finer. Clarify + examples = Understand. Brute force + optimise = Match & Plan.
0–3 min3 min
Clarify
Make sure you are solving the right problem.
do
- Restate the problem in your own words.
- Ask about input size, negatives, duplicates, empty input.
- Ask what to return when there is no answer.
say
- Let me restate the problem to make sure I understand it.
- How large can the input be? Can it be empty?
3–5 min2 min
Examples
Turn the words into one small, concrete case.
do
- Write one normal example and its answer.
- Write one tricky example: empty, one element, or duplicates.
say
- Let me try a small example: for [2, 7, 11, 15] and target 9, the answer is indices 0 and 1.
- What should happen for an empty array?
5–8 min3 min
Brute force
Put a correct answer on the table, even a slow one.
do
- Say the simplest idea that works, like checking every pair.
- State its time and space.
- Don't code it yet, unless time is very short.
say
- The simplest approach is to check every pair. That is O(n²) time and O(1) space.
- That works, but it will be slow for large inputs. Let me look for something better.
8–12 min4 min
Optimise
Find the slow part and fix it with the right data structure.
do
- Point at the slow part: "the inner loop searches for the partner".
- Try the pattern checklist: hashing, two pointers, sliding window, sorting, heap, BFS / DFS, DP.
- Get the interviewer to agree before you type.
say
- The slow part is searching for the partner. A HashMap can do that lookup in O(1) on average.
- So the plan is one pass with a HashMap: O(n) time and O(n) space. Does that sound good to you?
12–30 min18 min
Code
Translate the agreed plan into clean Java, talking as you go.
do
- Write the steps as short comments first, then fill them in.
- Use clear names:
seen,left,right, nota,b,c. - Say what each block does as you write it.
say
- I will write the steps as comments first, then fill them in.
- Now I store each number with its index, after checking for its partner.
30–38 min8 min
Test
Find your own bugs before the interviewer does.
do
- Dry run your small example, line by line, tracking the variables.
- Run two or three edge cases: empty, one element, duplicates, negatives.
- Fix bugs calmly and say what you changed.
say
- Let me dry run this on the example before I call it done.
- Now an edge case: what happens with a single element?
38–45 min7 min
Complexity & follow-ups
Show you know what your solution costs and how it would change.
do
- State time and space separately, with the reason.
- Mention trade-offs: "faster, but uses more memory".
- Answer follow-ups, then ask one or two questions of your own.
say
- Time is O(n) because each element is visited once. Space is O(n) for the map.
- If the array were already sorted, two pointers would find the pair in O(n) time with O(1) extra space.
02
Three clock rules
Minute 12: something is on the table
No better idea by about minute 12? Say so, and code the brute force. A working slow answer scores better than a perfect idea with no code.
Minute 30: stop adding, start checking
Around minute 30 the code should be complete. Leave the extra polish. Testing is worth more now.
Stuck for 2 minutes? Talk
If you have been silent for about two minutes, say what you are trying. That gives the interviewer a chance to help.
train itlines for being stuck