They added a second part to the problem, and you rewrote the first in silence

Part one works and the tests pass. The interviewer says "nice, now let's extend it", reads out a new rule, and you start editing straight away. Three minutes later part two passes, and nobody in the room, you included, knows whether part one still does.

The situation

More coding rounds are now built in parts: a small working system, then a new rule on top, then another. A count of candidate-reported questions, published on DEV this week by a prep site, found that at the frontier AI labs the most common coding topic is building a small working system in parts. What changes in this format is that the code you already wrote becomes something you can break.

Here is an original example. A bank of parcel lockers comes in three sizes. Part one: deposit(size) returns the id of a free locker of exactly that size, or None; collect(locker) frees it. Part two, read out by the interviewer: "if no locker of that size is free, use a larger one."

from collections import deque

SIZES = ["small", "medium", "large"]

class Lockers:
    def __init__(self, counts):
        self.free = {s: deque(f"{s[0].upper()}{i}" for i in range(1, counts.get(s, 0) + 1))
                     for s in SIZES}
        self.size_of = {}

    def deposit(self, size):
        for s in SIZES[SIZES.index(size):]:   # part two: this size, then larger ones
            if self.free[s]:
                locker = self.free[s].popleft()
                self.size_of[locker] = s
                return locker
        return None

    def collect(self, locker):
        self.free[self.size_of.pop(locker)].append(locker)

Written as a loop, part one's line was for s in [size]:. Part two changed that one line and nothing else. collect did not change at all, because it frees the locker into the pool of its own size, whatever the parcel was.

What goes wrong

The silent version of part two is usually a quick rewrite of the loop:

for s in SIZES:   # "try the other sizes too"

The part-two example passes. With one small and one medium locker, two small parcels get S1 and then M1. But the rewrite also searches the smaller sizes, so it broke a rule from part one that nobody repeated. The smallest input that shows it: one small locker, and deposit("large"). Part one returned None. The rewrite returns S1, a large parcel in a small locker.

There is a second gap, and it is not a bug in either version. With one small and one medium locker, deposit two small parcels and then one medium parcel. The medium parcel has nowhere to go and gets None. The new rule does not say whether that is right, or whether the second small parcel should have waited instead of taking the medium locker. That is the question to ask before you code, not after.

What to say out loud

Before touching the keyboard, three sentences:

"What stays: a parcel never goes into a smaller locker, and collect returns a locker to its own size, so collect does not change."

"What changes: deposit tries its own size first, then each larger size in order. That is one line."

"One question first: with one small and one medium locker, if two small parcels take both, a medium parcel is refused. Is that acceptable, or should a small parcel only move up when it would otherwise be refused anyway?"

Then make the change, and before you say "done", rerun part one aloud: "Part one's case: one small locker, a large parcel. Still None, because the loop starts at the parcel's own size." That last sentence is the one that tells the interviewer you treat the earlier code as something you are responsible for, not something you have finished with.

If you are unsure which rule from part one still holds, say so and say what you will assume: "I'll assume no parcel ever goes down a size. Tell me if that changes."

The exercise

  1. Take a problem you solved this week and invent a second part for it yourself: one new rule, one sentence long.
  2. Before editing, write three lines: what stays, what changes, and one input the new rule does not settle.
  3. Write down the inputs you used to check part one. Make the change, then run every one of them again by hand.
  4. Say the three sentences and the rerun aloud with a two-minute timer, and record it.
  5. Play it back and count the rules from part one you did not mention. Do it again until the count is zero.

Where this fits in Gadfly

Gadfly is a voice tutor for interview practice with four rooms: algorithms, system design, behavioral and code review. In the algorithms room you code in Java or Python and talk the problem through with a tutor that speaks English. In tutor mode it asks the next question and never reveals the solution, so "what happens to a large parcel when only a small locker is free?" is the kind of question it asks rather than answers. In mock mode it behaves like an interviewer: no coaching during the round, and a debrief at the end quoted from the session record. That debrief is a diagnosis, not a grade.

Published 1 December 2026 · Explain it out loud · all notes · feed

This note was drafted by Gadfly's scout — an automated writing agent run by Dmytro Hryshchenko — and checked by rules against the product's claims registry, not read by a person before it went live. The exercise is original. Spotted a mistake? [email protected].