Stage 1 of 3: Register and pick
A payments API runs on several backend instances, and each request goes to one of them.
Implement register(address), addresses() and pick() of LoadBalancer in load_balancer.py.
register(address)adds an instance's address, a string such as"10.4.0.17:8443", to the registry. The registry holds at mostLoadBalancer.CAPACITY(10) addresses, each once: registering an address that is already there raisesAlreadyRegistered, even when the registry is full, and registering an eleventh address raisesRegistryFull. A refused address leaves the registry as it was.addresses()returns the registered addresses as a tuple, in the order they were registered.pick()returns one of the registered addresses, chosen at random: every registered address is equally likely, and each pick is independent of the picks before it. With no address registered it raisesNoInstances. The tests check this over thousands of picks.
A new LoadBalancer() starts with an empty registry of its own.
Example
lb = LoadBalancer()
lb.register("10.4.0.17:8443")
lb.register("10.4.0.12:8443")
lb.register("10.4.0.17:8443") # raises AlreadyRegistered
lb.addresses() # ("10.4.0.17:8443", "10.4.0.12:8443")
lb.pick() # either address, each half of the time
Done when Submit goes green.
Constraints
- Python 3.12 standard library only
- Editable:
load_balancer.py - Read-only: the files in
tests/ - An address is a string such as
"10.4.0.17:8443"; two addresses are the same when the strings are equal
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.
- Stage 2: Strategies. The way the balancer chooses becomes something it is given, and a second way of choosing joins the first.
- Stage 3: Many threads. Many threads register and pick on one balancer at once, and every rule must still hold.
The files you get
- Yours to edit: load_balancer.py.
- Read-only: tests/__init__.py.
- Tests you can read and run: tests/test_part1.py. Hidden tests run on Submit.
The round: an agent in the editor
The assistant here works like the one in the interview IDE. It reads your files, runs code and proposes changes, and you accept or reject each one. It doesn't volunteer ideas, so what gets built is what you asked for. Along the way the interviewer asks about your decisions, and at the end the report says what you checked and what you accepted unread.
Frequently asked, briefly answered
Is Load Balancer 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?
Revolut. It is modelled on Revolut's round: Build It, a live coding round in your own IDE over a shared screen: you build a small in-memory service test first, and since July 2026 candidates report AI being allowed. Based on candidates' reports of Revolut interviews. Nyrion wrote this version, so the question you get may differ.
Do I bring my own AI tool?
No. The assistant is in the editor, same as in the interview IDEs at Meta, Stripe and Amazon. What you choose at Begin is the format: an agent that proposes changes you accept or reject, or an answer-only assistant that can't write code.
What does the interviewer ask?
3 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.
More like it: every practice problem, how Revolut runs its AI round, the AI coding interview guide.