Elevator System
A bank of elevators that dispatches requests efficiently with pluggable scheduling.
Hard50 minState patternScheduling strategyConcurrency
Design the control system for a bank of elevators in a building: accept hall calls and in-car requests, dispatch elevators efficiently, and move cars safely. It's hard because it mixes a per-car state machine, a dispatching strategy, and real-time concurrency.
Requirements
Functional
- N elevators serving floors 0..F.
- Hall calls: a person on a floor presses UP or DOWN.
- Car calls: a person inside presses a destination floor.
- Dispatcher assigns each hall call to the best elevator.
- Each car moves floor by floor, stops at requested floors, opens and closes doors.
- Display current floor and direction; capacity/overload detection; maintenance mode; emergency stop.
Non-functional
- Minimise average wait time and avoid starvation (every request is eventually served).
- Thread-safe: button presses arrive concurrently with car movement.
- Scheduling policy must be swappable (SCAN/LOOK, nearest car, zoning for peak hours).
- Safety: doors never open while moving.
Try it first
Set a timer, sketch your own design on paper, then compare it with the reference walkthrough.
50:00
Defend it out loud
The AI interviewer will probe your design for Elevator System and score it.