Step 1: Requirements
Requirements
Questions to ask the interviewer
- How many elevators and floors?
- What scheduling algorithm — FCFS, SCAN, LOOK, destination dispatch?
- Capacity limit per elevator?
- Do we handle priority (fire/VIP)?
- Maintenance mode per elevator?
Functional requirements
- Building with N floors and M elevators.
- External buttons (up/down) on each floor; internal buttons (floor numbers) inside each elevator.
- Elevator picks up and drops off passengers efficiently.
- Scheduling algorithm assigns external requests to the best elevator.
- Each elevator has states: Idle, MovingUp, MovingDown, DoorOpen.
- Display current floor and direction on each floor.
Non-functional requirements
- Fair scheduling (no starvation of distant floors).
- Minimize average wait time.
- Extensible scheduling (swap algorithms without changing elevator logic).
Assumptions
- Single building.
- No weight sensor (just max capacity count).
- All floors are accessible by all elevators.