Design elevator scheduling for small building
Company: PayPal
Role: Data Scientist
Category: System Design
Difficulty: medium
Interview Round: Onsite
##### 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:
1. **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.
2. **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).
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.
4. **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.
5. **Data structures.** Describe the supporting data structures and the control state machine.
6. **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.
Quick Answer: This PayPal data-scientist system-design question asks you to design the control policy for a single elevator serving a small building (3 floors plus a basement). A complete answer defines objectives, constraints, inputs, and state; proposes a SCAN/LOOK scheduling strategy with basement/peak priority and anti-starvation; specifies data structures; and lays out a discrete-event simulation to compare policies under varying demand.