Codebase Orientation
Every other skill in this track sits on top of this one. The round hands you a multi-file project — existing classes, a data model somebody else chose, control flow somebody else wrote, and a bug somebody else planted — and then starts a sixty-minute clock. You did not write any of it. Hello Interview’s write-up of Meta’s format puts reading unfamiliar code near the top of the preparation list precisely because the whole interview is built on code that arrives as a stranger (Hello Interview, Meta’s AI-Enabled Coding Interview).
The uncomfortable part is that reading feels like not working. The editor is open, the tests are right there, the interviewer is watching, and spending five minutes scrolling through files looks like hesitation. It is not. It is the highest-return five minutes in the session, and candidates say so afterwards with remarkable consistency.
Read in this order
Not “read the code.” A specific order, every time.
1. Data models and types. Classes, structs, enums, type aliases, constants at the top of the file. What entities exist, what fields they carry, what each field is typed as.
2. Entry points. The main, the driver, the handler, the CLI. How does input get in, what gets called, what comes out.
3. The one function the problem names. The brief will point at something — a traversal, a scheduler, a parser. Read that function line by line, not by skimming.
4. The tests. Last, and read them as closely as you read the function.
The order is doing real work. The data model tells you what the code believes about the world: that a distance is an integer, that a grid cell is a single character, that an ID is unique. Most planted bugs in this format are not clever algorithms gone wrong. They are a disagreement between what a type promises and how some caller actually uses it. One candidate in the Hello Interview round-up lost time chasing type-casting errors that reading the data models first would have handed them for free — an integer being widened to a double while the rest of the system still expected an integer. Another reported essentially the same shape of problem from the other direction.
Entry points come second because they turn a pile of files into a sequence. Once you know that main reads input, builds one object, calls one function and prints the result, you know which of the five files you can safely ignore. That is the fastest way to shrink the problem.
The named function comes third, and this is where you slow down. Read every line. Specifically, look for things that are created and never used — a variable assigned once, a set built and never consulted, a parameter accepted and dropped. Dead state is the signature of a planted bug, because it is what a working implementation looks like after someone surgically removes one line.
Reading the tests is reading the spec
The tests come last in the order but they are not an afterthought. In this format the test file is the only written specification you get, and it is more precise than the problem brief.
What the tests assert tells you what the code is supposed to do. A test named “exit walled off” expecting -1 tells you unreachability is a legal outcome, not an error. A test on a two-cell grid tells you the degenerate case is in scope. A test that passes a large generated input tells you performance is graded. Read the assertions and you have the contract; read the test names and you have the author’s mental model of the problem.
This matters even more in phase three, where the optimisation hides in the input data rather than in the algorithm. Meta’s later test files are reportedly built to stress different dimensions on purpose — the same problem with a different input shape favours a different data structure. You find that by reading the data, not by staring at your code.
A worked example: the maze solver
The maze solver in our sandbox is a real instance of this. Run it on a three-by-three grid and it prints:
ERROR: maze too complex
The error message is a lie, and it is a very attractive lie. It points at the input. It suggests the maze is the problem, that the guard is too tight, that the fix is a bigger number. Here is the function:
def solve(maze):
start = maze.find(START)
goal = maze.find(EXIT)
frontier = [(start, 0)]
seen = set()
steps = 0
while frontier:
steps += 1
if steps > MAX_STEPS:
raise MazeError('maze too complex')
(r, c), dist = frontier.pop()
if (r, c) == goal:
return dist
for nr, nc in neighbours(maze, r, c):
frontier.append(((nr, nc), dist + 1))
return -1
Read it in order and you find it in about fifteen seconds. seen is constructed. seen is never added to. seen is never checked. The traversal walks from a cell to its neighbour and straight back again, forever, until the step counter trips. The exception is not the bug. The exception is the guard doing its job, reporting a symptom it has no way to name correctly.
The most common wrong turn is raising MAX_STEPS. It is the number in the error path, the assistant will happily discuss it if you ask about the error message, and it fixes nothing — the traversal still revisits cells, so a larger cap just buys a longer wait before the same failure. On the generated grids in phase three it also produces a wrong answer rather than an error, because a stack-based frontier without a visited set returns the first path it stumbles onto, not the shortest.
Notice what reading bought you that the error message did not. The message blames the data. The code tells you a set is declared with no reads and no writes, which is not something an author does on purpose.
Interviewers will not agree on this
Some interviewers hand you the tour: here are the files, read the code first, take your time. Others open with a variation of “let’s run it and see what happens.” One E7 candidate told Hello Interview that jumping straight to the solution because the interviewer said to run the test was their biggest regret, and that they should have stepped back and read the whole thing first.
So: read anyway, and say that you are doing it. “Before I run anything I want to spend three or four minutes on the data model and the traversal, so I know what I’m looking at” is a sentence no interviewer penalises. It converts silence into a stated plan, which is the thing they are grading anyway. If they push back and genuinely want you in the tests first, fine — read the tests first and the models immediately after. The order is a default, not a ritual.
How to practice it
Reading speed in unfamiliar code is a trained skill and it trains quickly.
- Read open-source code you have no stake in. Pick a small library, find the entry point, and trace one feature end to end without running anything.
- Use repo-exploration tooling to get the shape of a project fast, then verify its summary against the source yourself. The summary is a hypothesis.
- Work the problems in the sandbox. Every one ships a planted bug reachable by reading, and the assistant is deliberately unhelpful about finding it for you.
- If you want the pure version of the drill, open a sandbox problem, read for five minutes, then write down what the bug is before you run a single test.
The claim to internalise is the trade: five minutes reading saves fifteen minutes debugging. That ratio is why the reading phase survives contact with a ticking clock.
In the interview room
Here is the drill, minute by minute, for the first eight minutes of the round. After your interviewer finishes the platform tour you have roughly fifty minutes of working time, and this spends six of them on purpose.
Minute 0. Say it out loud. Before you touch anything: “I’m going to read before I run. Four minutes on the data models and the main function, then I’ll run the tests.” You have now made reading a visible decision rather than an absence of activity. If the interviewer redirects you, follow them — but you got credit for having a plan.
Minutes 1-2. Models and entry point. Open the file with the types in it first. Out loud, name the entities and the one or two fields that look load-bearing: “so a Maze is a list of character rows, distance is an int, and walls are a single character.” Then the driver: “main reads stdin, builds one Maze, calls solve, prints the result or an error.” You are now two sentences from being oriented.
Minutes 3-5. The named function, line by line. Finger on the screen, one line at a time. Three questions as you go, and you should be able to answer all three before you type anything:
- What data structure is this actually using, and what does that choice imply? A
pop()off a list is a stack, which means depth-first, which means not-shortest-path. - Is there any state here that is written and never read, or read and never written? That is your bug, four times in five.
- What does this function do on the boundary — empty input, start equals goal, no solution at all?
Minutes 5-6. The tests. Read the names and the expected values, not the harness. Say what you learn: “there’s a case expecting minus one, so unreachable is a valid answer and not an exception.” If there is a large or generated input among the tests, call it out now — you have just found phase three early.
Minutes 6-7. State your diagnosis before you run. This is the single highest-value sentence in the first ten minutes: “I think the error message is misleading. seen is allocated and never used, so the traversal revisits cells and trips the step guard. Let me confirm with a print before I change anything.” You have shown a hypothesis, a reason, and a verification step. Then run it.
What to say when told to skip reading. If the interviewer opens with run-the-tests, run them, read the failure, and then take your reading time with a reason attached: “the error says the maze is too complex, which I don’t believe for a three-by-three grid, so I want to read the traversal before I trust that message.” Nobody argues with that.
Using the assistant during orientation. It is useful for navigation and not for diagnosis. Good: “list the files and tell me what each one is responsible for,” or “explain what this function does line by line.” Avoid “where is the bug” — in the real round it has reportedly been shaped not to answer that, and one candidate described asking it to describe the codebase and getting a tour of the functionality with no mention of any problem, in an environment where his own tools had surfaced the bugs immediately (Hello Interview). Asking and getting nothing costs you ninety seconds and your composure. Ask it to explain code you have already read, and use its answer as a second opinion on your own.
If you are seven minutes in and still lost. Stop reading breadth-first and go depth-first on one test. Pick the smallest failing case, trace it by hand through the function, and narrate the trace. “On a one-by-two grid, start is zero-zero, goal is zero-one, we pop start, we push goal and we push nothing else — so why does this loop?” Hand-tracing the smallest case is the fallback that always works, and it is also extremely good signal: it is what the interviewer does when they are debugging.
The one thing not to do. Do not change the number in the error path. Raising an iteration cap, widening a timeout, bumping a recursion limit — these all make the symptom quieter and leave the defect in place, and every interviewer in this format recognises the move on sight. If you find yourself editing a constant that appears in an error message, say the sentence out loud and listen to it: “I’m making the safety valve looser so the broken loop has more room.” Then go back and read.
Drill this before the round. Open any problem in the sandbox with a timer. Five minutes reading, no running. Write your one-sentence diagnosis. Then run the tests and see whether you were right. Score yourself on the diagnosis, not on the fix — the fix is the easy part once you have read the code. When you can get the diagnosis right in five minutes on three different problems, this skill is done and you can move on to planning before you prompt.