What they’re really asking
If you only remember one thing, say this in the first minute: “I’ll run the tests, pick the first failure and explain it before I ask the assistant anything. When the assistant’s code calls a function I haven’t seen, I’ll search the repo before I trust it. Before each new stage of inputs, I’ll ask what the next stage could add, and pick a representation that survives it. And I’ll add tests for the new inputs first, then rerun the earlier stages’ tests too.”
The rest of this page explains each part of that answer.
This round tests verification under pressure. Two traps are waiting, and the round is decided by whether you catch both before they cost you the clock.
A normal coding round has one source of bugs: you. Here there are two. The assistant is a chat tool backed by a large language model (LLM), a program trained on huge amounts of text and code that writes a plausible reply to what you type. When it can only see what you paste, it fills gaps with guesses that look exactly like real code. And the problem itself changes under you: a choice that was clever for stage one breaks at stage three.
A rejected Meta L5 machine-learning engineer candidate describes a small Python codebase of several files, with tests and bugs. The task was to run the tests, explain why one fails, then implement a missing core function as the inputs widened from letters to numbers to a mix. The model invented helper functions that did not exist, and a first approach (a bitmask) collided once digits appeared (Aced (formerly Exponent)).
Clarify first
- Which test should I start with, and may I run tests file by file?
- The full input alphabet for the final stage: letters only, digits, upper and lower case, any Unicode?
- What the function must return for empty or invalid input.
- Are there performance limits that rule out a simple set or dictionary?
- Can the assistant see the repo, or only what I paste? If only what I paste, it will guess at names.
Answer
Words you need first
- Invented helper: a call to a function that sounds right but doesn’t exist in the codebase, such as
normalize_input(s)when no such function was ever written. The model predicts likely-looking code, and a likely-sounding name is its best guess when it can’t see the repo. - Bitmask: an integer used as a row of on/off switches, one bit per possible character. “Have I seen
c?” is one bit test, which is fast and uses almost no memory. - Representation: how you store the data. The algorithm usually follows from it.
Explain the failing test before prompting
Run the suite, pick the first failure, read the assertion and the code path, and say the cause out loud. Running tests one file at a time keeps the output readable; the candidate did this (Aced (formerly Exponent)).
Say it like this, for example: “This test expects the function to skip spaces, and the current code counts them. I’ll fix that before I touch the missing function.”
Treat every unknown name as suspect
If the assistant’s code calls a helper you haven’t seen, search the repo before reading further. If it doesn’t exist, say so and re-prompt: “Use only these functions”, pasting their signatures. An assistant that sees only your paste will keep guessing; give it the context once instead of fixing its guesses one by one.
Say it like this: “It’s calling normalize_input. Let me search. It doesn’t exist, so I’ll paste the real helpers
and ask again.”
The worked example: a bitmask meets digits
Assume the missing function answers “are all characters in this string different?” (an illustration; the report doesn’t name the function). Follow it through the three stages of inputs:
| Stage | Input | Representation | Result | What to say in the interview |
|---|---|---|---|---|
| 1. lowercase letters | "abc" | 26-bit mask, bit ord(c) - ord('a') | correct: all different | ”One integer, one bit per letter. Fast and tiny.” |
| 2. digits arrive | "a0" | same mask, digits mapped with ord(c) - ord('0') | wrong: a and 0 both use bit 0, so it reports a repeat | ”Two characters share a switch. That’s a collision.” |
| 2, other draft | "a0" | same mask, same formula for every character | crashes: ord('0') - ord('a') is −49, a negative shift | ”Digits sit below letters in the character table.” |
| 3. mixed | "aA0" | a set of characters, or a 62-slot array | correct | ”A set handles any character; 62 slots keep it fast if the alphabet is fixed.” |
The point is not bitmasks. It is the habit: before each stage, ask what the next stage could add. If the interviewer says “now digits”, the next step may well be upper case or symbols.
Your options, said out loud:
- A set (or a dictionary of counts) handles any character. It costs more memory, which rarely matters at these sizes.
- A larger fixed array, such as 62 slots for upper case, lower case and digits, keeps the speed if the alphabet is known and fixed.
Say which and why, then let the assistant implement it: “I’ll switch to a set. The alphabet keeps growing, and the set never collides.”
Prove each stage
Add tests for the new input class before the implementation:
- digits only;
- mixed letters and digits;
- a letter and a digit that would share a bit under the old mapping (
"a0"), which is the test that proves the collision is gone.
Then rerun the earlier stages’ tests too. A rewrite for stage three can quietly break stage one.
Senior vs Staff
Widening inputs
Senior
- Catches the invented helper by searching, and writes the collision test that breaks the bitmask.
Staff
- Picks the representation by asking what the next requirement could be, and says what each choice costs in memory and speed.
Small-team version
Invented helpers are a daily cost with coding agents (assistants that can edit files and run commands) that lack repo context. Fix the context, not each symptom:
- Let the agent search the codebase instead of guessing from a paste.
- Keep an
AGENTS.md, a file of standing instructions the agent reads at the start of every session, that names the core modules and helpers. - Make CI fail fast on undefined names. Type checks and linters catch an invented function in seconds, before a person spends review time on it.
- Write a test for the next input class. Representations chosen for today’s inputs are where small codebases break next quarter. One extra test costs minutes; the bug it prevents usually costs far more.
Pitfalls
- Reading generated code as if every name in it exists. Search for any helper you don’t recognize.
- Running the whole suite at once and drowning in output. Run one file at a time while you diagnose.
- Keeping a clever representation after the inputs outgrow it. The bitmask was right for stage one and wrong for stage two.
- Implementing the new stage without rerunning the earlier stages’ tests. Each rewrite can break an earlier promise.
Go deeper
- Family walkthrough: AI-assisted coding round in a provided codebase, especially the prompt that says “only use functions that exist” in phase 2.
- Practise explaining a failure before prompting on Build Your Own Kafka-lite.