System design · must-tier · asked at Amazon, Apple, Google, Meta, Microsoft, Netflix
Elevator System
Prompt
"Design the software for the elevators in an office building. Several cars, a few dozen floors, buttons in the hall and inside the cars. Show me the objects and how you decide which car answers a call."
Clarifying questions
- How many cars and floors? Say 4 cars and 30 floors. Small enough that any scheduler is fast; large enough that a bad scheduler is visibly bad.
- What inputs exist? Hall calls (floor + direction) and car calls (a floor pressed inside a specific car). Door open/close and emergency stop are follow-ups.
- Is this real-time control or a simulation? A discrete simulation: the system advances in ticks, each tick a car moves one floor or spends one tick with doors open. The interviewer wants to see the state machine advance, not talk to hardware.
- What is the goal of the scheduler? Minimize average wait time, avoid starvation. No express or zoned cars in the first version.
- Can calls arrive while the system is stepping? Yes. Buttons are pressed from other threads (or callbacks) while the tick loop runs, so the request intake must be thread-safe.
- Capacity limits? Ignore weight. Mention that a full car should skip hall calls.
Requirements
Functional
- Accept hall calls and car calls at any time.
- Assign each hall call to exactly one car; a car serves its stops in a sensible order.
- Advance the whole system by one tick: move cars, open and close doors, clear served stops.
- Expose car state (floor, direction, door) for a display.
Non-functional
- No lost calls and no call served twice.
- No starvation: a call placed at any floor is eventually served even under continuous load.
- Scheduling cost per call must be small: O(cars) or O(cars x floors) is fine at this size.
- Scheduler policy must be replaceable, because "compare two policies" is the standard follow-up.
Numbers
- 4 cars x 30 floors = at most 120 distinct pending stops. One tick per second of simulated time. Even a naive O(cars x floors) evaluation per call is a few hundred operations, which frees you to choose the clearest algorithm rather than the cleverest.
Last reviewed 8 September 2026
Locked
Class design · Core interfaces · Deep dives · Failure modes & follow-ups · Extensibility · Level rubric · Company variations
The rest of this question — the worked approach, the design walkthrough, complexity, follow-ups and how each company frames it — is part of the guides.
Get the full guide
Pick the company you're interviewing with. Each guide has every question tiered for that loop — one-time purchase, lifetime access.
Secure payment by Stripe · instant access · refund questions: [email protected]
Also in: Apple, Google, Meta, Microsoft, Netflix
Interviewing at more than one? All 6 guides for $499 · save $395
Not ready to buy? Get the free starter pack — 13 questions with full solutions.