Skip to the guide

Design an elevator system

IntermediateCase study12 pages

The interviewer asks you to design the software for the elevators in a building, with several cars and buttons on every floor. Picture a river with several ferries and numbered piers. People ring a bell at a pier, and a clerk takes each call in turn and writes that pier on one boat's list. Each boat works along the river until nothing is left ahead, then turns round.

It is also asked as "design a lift system", and the closest other case study is the vending machine, which also gives each state a class. Everyone has ridden an elevator, so the round goes on what each state does and which car takes a call.

Below is a full 45-minute round on the LLD framework. You are the candidate. At each Guess before you read on, stop and answer first. The full runnable project, with its tests, is a download in Java, JavaScript and Python.

Run the full project

This design as a project you can run, with its tests and a demo. You only need Java 21, Node 24 or Python 3.13. The README says how to run it.

Step 1 · Clarify the requirements and cut the scope

Minutes 0–5 · How this step works

Interviewer: Design an elevator system.

You: How many cars and floors are there?

Interviewer: Four cars and 20 floors, numbered 0 to 19.

You: Which buttons do I handle?

Interviewer: Up and down on each floor, a floor button inside each car, and door-open and door-close.

You: Who decides which car answers a floor's button, and will that rule change?

Interviewer: You pick a sensible rule. The building manager will want to change it later.

You: Do I drive real motors, and can people press while cars are moving?

Interviewer: No motors. Treat a car as moving one floor per tick. Yes, people press at any time.

You: Then I'll build calls from floors, presses inside cars, and door buttons. Doors never open while a car is moving, and every call is served in the end. Weight limits, fire mode and maintenance are out. OK?

Interviewer: Good.