The Coding Round in One Picture: Twenty Minutes, Small, Correct, Tested and Said Out Loud
A coding round is about 20 minutes: two for questions, eight for one correct class, about four to fit it to the real case, four for tests and two for trade-offs, while you talk the whole time. Name four edge cases first, and know the shape shared by the rate limiter, the TTL and LRU cache and the top-k merge.
What you will learn
- Say what a 20-minute AI engineering coding round tests: small, correct, tested and explained
- Split the 20 minutes into questions, core, fitting, tests and trade-offs
- Name four edge cases before writing a line
- Recognise the three classic prompts and the shape they share
Before you start
- Basic Python
- Writing small unit tests
This article puts the whole coding round into one picture: what it tests, how the twenty minutes usually go, and what the interviewer listens for while you type. There's no code here, just the shape of a good answer.
What the round tests
You get a small problem, about twenty minutes, and the interviewer watches you work. They're checking four things:
- Small. One class that does one job, not a framework.
- Correct. The core logic is right, and the edge cases are handled.
- Tested. A few tests that prove it works.
- Out loud. You explain each step while you type.
None of it is about clever tricks.
The round in one picture
- About 2 minutes of questions. What's the input, how big can it get, and what should happen when it fails?
- About 8 minutes on the core. One class, and it has to be right.
- About 4 minutes to fit it to the real case, for example one limit per tenant.
- About 4 minutes for tests.
- The last 2 minutes for trade-offs: what you'd change with more time or more machines.
And across the whole bar, you're talking. That line never stops.
Edge cases first
One habit sets strong candidates apart: they name the edge cases before they write a single line.
| Edge case | What to say |
|---|---|
| Empty input | No items, an empty list, or a key you've never seen |
| Too big to fit | A request that can never succeed, so fail fast instead of waiting forever |
| Ties | Two items with the same score: pick a rule and say it |
| Two calls at once | If another thread can slip in between a read and a write, that's a bug waiting to happen |
Four lines, thirty seconds, and the interviewer already trusts your code a little more.
Talk while you type
Think of a driving test. The examiner can't see inside your head, so you show it: mirror, signal, then turn. The coding round works the same way.
- As the first lines go in, say the plan: first the core, then the tests.
- At the tricky part, say why: "this read and this write have to be one step."
- When an edge case shows up, point back to the one you named at the start.
- Near the end, say what you'd add with more time, like shared state across many servers.
The interviewer should never have to guess what you're thinking.
Three classic prompts
In AI engineering rounds, three prompts come up again and again:
- A rate limiter. A token bucket per tenant, safe when many threads call it at the same time. The idea behind it is in Token Rate Limits.
- A TTL and LRU cache. A size limit, an expiry time, and a key that knows which tenant is asking (see Caching for AI Apps).
- A top-k merge. Every shard sends a full k, you merge once, and you cut once at the end. Worked through in Top-k Merge and Rank Fusion.
Three different problems, one shape: a small core, the edge cases, and a few tests. Learn the shape, and the exact prompt matters a lot less. If you're interviewing for an ML role, the from-scratch version of this round is in ML Coding Round: From Scratch.
The trap
- Typing in silence for twenty minutes, so the interviewer can't follow along.
- Going for a clever design that never actually runs.
- Skipping the tests and finishing with "I think it works".
A working core with tests beats a clever design every time. Get the simple version working first, then make it better.
Recap
| Rule | What it means |
|---|---|
| Small | One class that does one job |
| Correct | The core is right, and the edge cases come first |
| Tested | A few tests that prove it |
| Out loud | The interviewer hears every step |
| Time | 2 questions, 8 core, then fitting, testing and trade-offs |
Try it yourself
Set a timer for twenty minutes and take the rate limiter prompt. Before you type, say your four edge cases out loud. At minute ten, check: is the core already working?
Related course on Udemy
The Python Architect Masterclass: Full Stack to AI Engineer
Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)Related posts
The ML Engineer Interview Loop: Five Rounds, What Each One Looks For, and a Simple Rubric
The rounds you go through for one ML engineer job: recruiter screen, coding, ML depth, ML system design and behavioural. What each round looks for, the follow-up it brings, and a four-check rubric for your own answers.
The Answer Framework for Technical Interviews: Five Moves, Scored Out of 24
Good interview answers share one shape: a 30-second answer, the mechanism, the trade-off, the metric and the failure test. Worked on one question about a batch job starving everyone else, with a 24-point example rubric.
From Symptom to Pattern: How to Answer "Which Pattern Would You Use?" in an Interview
Start from what you can see, not from the pattern you know. A four-step rule (symptom, cost, metric and failure test, ship first), a symptom table, one worked answer for 429s at peak, and the trap of using a prompt as a lock.
The ML System Design Framework: Eight Steps, in Order, on a Spam Filter
One repeatable route through any ML system design question: goal, metric, data, features, model, serving, monitoring and failure. Worked on an email spam filter, with the follow-ups and a three-check rubric.
