Progressive build Medium · 75 minutes
One spec revealed in levels. Each level adds requirements to the code you already wrote.
The bakery wants a small in-memory database for its order records.
Each record has a key (an order id like order-1042) and
any number of fields, each a field name mapped to a string value:
flavour -> chocolate,
status -> proofing, and so on.
This is a progressive build: one task, revealed in four levels, where each level adds to the last. It's the format of CodeSignal's Industry Coding Framework and similar leveled coding screens. The catch is that the design you pick for level 1 decides how painful levels 3 and 4 are, and every later level has to keep the earlier levels' tests passing.
The starter repo gives you the public interface: an
OrderDatabase class in cakedb/database.py
whose methods all raise NotImplementedError, with
docstrings that specify the behavior exactly. There's also a working
command-line driver (cakedb/cli.py) that replays a file
of queries, a format_field helper, and one test file per
level. Run the tests from the repo root:
python3 -m unittest discover -s tests
In a real progressive round you only see the next level once the current one passes. Here all four are listed, but do them in order, and for the most realistic practice, don't read a level's docstrings until you've finished the one before it.
Level 1: records (tests/test_stage1.py).
set(key, field, value),
get(key, field) and delete(key, field).
get returns None for a missing record or field, and never raises.set creates the record if needed and overwrites an existing field.delete returns True only if it removed a field. Removing a record's last field removes the record.
Level 2: scans (tests/test_stage2.py).
scan(key) and scan_by_prefix(key, prefix).
"field(value)" strings sorted by field name, using Python's default string ordering.
Level 3: timestamps and TTLs (tests/test_stage3.py).
set_at, set_at_with_ttl,
get_at, delete_at,
scan_at and scan_by_prefix_at, each
taking the current timestamp.
T with TTL N is live for T <= t < T + N. At exactly T + N it's gone.get_at returns None, scans leave them out, and delete_at returns False.set_at clears any TTL). A TTL of zero or less raises ValueError and changes nothing.
Level 4: backup and restore (tests/test_stage4.py).
backup(timestamp) and
restore(timestamp, timestamp_to_restore).
backup saves a snapshot and returns the number of records with at least one live field.restore uses the latest backup taken at or before timestamp_to_restore (a backup at exactly that time counts) and replaces the whole database with it. If there's no such backup it raises NoBackupError.r units left at backup time now expires at timestamp + r.
You're done when python3 -m unittest discover -s tests
passes all 93 tests. Then replay a day at the bakery with
python3 -m cakedb.cli examples/demo_queries.txt.
Time box: 75 minutes. Level 1 should take minutes; level 4 is the stretch.
There are hidden tests too, like the ones a progressive round runs on your code after you submit. They check the rules in the docstrings that the visible tests don't, including long runs of random calls.
Same format as Anthropic's coding assessment, OpenAI's technical screen and Stripe's practical coding round.
75 minutes, with the AI assistant on, and every stage open from the start. Good for learning the problem. Pick a company to practice with the time limit and AI rules of its real round.
Like a real round: each stage's instructions and tests show up only when the stage before it passes, so you can't read ahead, and neither can the assistant. 75 minutes. Your work here is kept separate from Standard.
Anthropic's candidate guidance says no AI in assessments or live interviews unless it tells you otherwise. The stages unlock one at a time, as in Interview mode. Our Anthropic guide
OpenAI says some rounds allow AI and some don't, and the prep materials tell you which. Candidates report no AI in standard coding rounds. The stages unlock one at a time, as in Interview mode. Our OpenAI guide
Stripe hasn't published an AI policy for candidates. Assume no AI unless your recruiter says otherwise. The stages unlock one at a time, as in Interview mode. Our Stripe guide
Run All tests to see which stages pass. The details for each stage are in README.md and the docstrings.
Working code, fast; a design that survives new requirements; and earlier levels that keep passing.
Loading the editor…
Choose All tests under the editor and click Run to see where you stand. On the starter repo, the existing tests pass and each stage's tests fail until you finish that stage.
Ask about the code, a failing test, or what to try next, the way you'd use an AI assistant in the interview. Your files and your last run go with every question, so there's nothing to paste.
In Edit mode it also changes your files when you ask it to, and you can undo each change. Some interviews' assistants can edit your code and some can only answer, so switch to Ask to practice the second kind.
It can often write a whole stage at once. In an interview you'd have to explain every line, so practice in small steps. Why, and how to talk about AI-written code
Answers come from Claude Sonnet and can be wrong. Run the tests before you trust one.
It's free with an Interview Cake login while the workspace is in beta, up to 30 questions a day.
Prefer your own editor? Download the starter repo, or use Download my code to take your work with you, and run the tests with python3 -m unittest discover -s tests.
The task, the rubric and the walkthrough are on the problem page.