Design elevator scheduling for small building
PayPalData Scientist · OnsiteLast updated
Design elevator scheduling for small building evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Question
Design the control policy for a single elevator serving a small building: 3 floors plus 1 basement (stops at B, 1, 2, 3). The goal is to decide, at each moment, where the elevator should go next so as to minimize passenger waiting and in-car travel time. Cover the following:
- Objectives. Define what you are optimizing for (e.g., minimize average wait time and average system time, bound tail latency, avoid starvation, handle peak traffic) and the trade-offs between them.
- Constraints. Specify the physical and operational constraints (car capacity / weight limit, floor-to-floor travel time, door open/close and dwell times, safety interlocks, stops only at B/1/2/3).
- Inputs and state. Identify the inputs the controller observes (hall up/down calls with direction, in-cab destination calls, current position and direction, door state, load estimate, timers) and the internal state it maintains.
- Scheduling strategy. Propose how the elevator decides its next stop. Discuss directional collective control (SCAN/LOOK), basement / peak-traffic priority, anti-starvation, capacity-aware boarding, and optional destination grouping.
- Data structures. Describe the supporting data structures and the control state machine.
- Simulation plan. Outline how you would compare candidate policies under varying arrival distributions (off-peak, up-peak, down-peak, bursty), which metrics to track, and how to validate the results.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.