Problem Statement
Design the LLD for an Elevator system with multiple cars and scheduling.
Explanation
Model ElevatorCar, Door, Motor, Controller, Scheduler, and RequestQueue. Use a scheduler Strategy (e.g., SCAN/LOOK) to assign calls to cars. Each car runs a finite state machine: Idle, MovingUp, MovingDown, DoorOpen, Maintenance.
Ensure safety with debounced sensors and command queue. Expose events for logging. Keep car state isolated; only the scheduler coordinates inter-car decisions.
Code Solution
SolutionRead Only
enum State{IDLE,UP,DOWN,OPEN}
interface Scheduler{ assign(call:HallCall): CarId }Practice Sets
This question appears in the following practice sets:
