Practice problem · DoorDash · Medium

Round Robin: Find the Bugs

Orders are handed out to backend workers in turn. 3 stages in Python written by you, with an assistant that only answers. Pro.

Stage 1 of 3: Orders in turn

Background. Orders are handed out to backend workers in turn. dispatcher.py defines Dispatcher, which keeps the workers in a list and a turn; API.md is its contract.

The ticket says orders are meant to go round the workers in turn, but every order goes to the first worker in service. Three tests in tests/test_part1.py fail.

Find out why and fix it. Don't change the public interface: the constructor and the five methods API.md describes.

Done when Submit goes green.

Constraints

  • Python 3.12 standard library only
  • Editable: dispatcher.py and dispatcher_tests.py
  • Read-only: API.md and all tests/test_*.py files
  • Worker ids are distinct strings of 1 to 20 ASCII letters, digits, - and _

What comes after stage 1

The next stages open once the tests for the one before them pass. Each raises the bar, the way an interviewer does in the room.

  1. Stage 2: Workers out of service. Workers taken out of service keep getting orders.
  2. Stage 3: Workers joining and leaving. Workers join and leave while orders flow; nobody may miss a turn or get two.

The files you get

  • Yours to edit: dispatcher.py, dispatcher_tests.py.
  • Read-only: API.md, tests/__init__.py.
  • Tests you can read and run: tests/test_part1.py. Hidden tests run on Submit.

The round: no AI, an assistant that only answers

DoorDash runs this round without AI. Here the closest format is answer-only: the assistant answers your questions and reviews your code when you ask, the way an interviewer would, and never writes a line of it. The interviewer asks about your decisions as you go, and the report states the format. You can switch to the agent format when you press Begin.

Frequently asked, briefly answered

Is Round Robin: Find the Bugs free?

It is a Pro problem. Free plan includes one complete problem, plus the first stage of several more, so you can see how a round works before you pay.

Which company asks something like this?

DoorDash. It is modelled on DoorDash's coding round, which runs without AI. Based on candidates' reports of DoorDash interviews. Nyrion wrote this version, so the question you get may differ.

Do I bring my own AI tool?

No. The real round has no AI, so this one opens answer-only: an assistant that answers your questions and can't write code. You can switch to an agent that proposes changes when you press Begin.

What does the interviewer ask?

6 questions along the way about your own code, and one at the end about the whole session. A weak answer gets one follow up. The answers go into the report, which ends with a hire or no hire verdict.

Start the problem

Sign in and the problem opens where you left it. New here? An account takes a minute to create, and the Pro plan starts at the first stage of this problem.

Start this problem → Sign in

More like it: every practice problem, DoorDash's interviews, the AI coding interview guide.