Design a Multi-Elevator System

Problem Design and code an elevator control system for a single elevator, then extend it to a bank of elevators servicing the same building, with a dispatcher deciding which car answers each hall call.

Requirements

  • requestFloor(elevatorId, floor) — internal car request from a rider inside.
  • callElevator(floor, direction) -> elevatorId — external hall call; the dispatcher picks the car.
  • step() / tick() — advance the simulation by one unit of time.
  • Elevator.getState() -> (currentFloor, direction, doorState, pendingStops).
  • The dispatcher must assign each hall call to exactly one elevator.

Areas to design

  • The single-car model: an explicit state machine and how it chooses its next stop.
  • The distinction between an internal destination request and a directional hall call.
  • The dispatcher's assignment policy across cars, and how scheduling avoids thrash and starvation.
  • Concurrency (simultaneous hall calls), capacity limits, and edge cases.
asked …
LeaderboardSalaryAccount