How to design an elevator system?

"Design an elevator system" is a classic object-oriented design (OOD) interview question. A strong answer follows four steps: clarify requirements, design the core classes, pick a scheduling algorithm, and then discuss scaling to multiple elevators. This guide walks through each step the way an interviewer expects to hear it.

Step 1: Clarify Requirements

Functional Requirements

  1. Elevator control: Move the elevator between floors and stop at requested floors.
  2. Two kinds of requests: Hall calls (a user on a floor presses up or down) and cab calls (a user inside selects a destination floor).
  3. Door control: Open and close doors safely at each stop.
  4. Direction and floor display: Show current floor and direction (up, down, idle).
  5. Emergency handling: Emergency stop, overload alarm, power failure behavior.

Non-Functional Requirements

  1. Low wait time: Minimize average wait and travel time.
  2. Scalability: Support a building with multiple elevators and many floors.
  3. Reliability and safety: The system must fail safe; doors never open between floors.

Stating both request types (hall calls vs. cab calls) early is a strong signal to the interviewer: it drives the whole design.

Step 2: Core Objects and Classes

An interview-ready object model needs only a handful of classes:

ClassResponsibility
ElevatorSystemEntry point; owns all elevators and dispatches hall calls
ElevatorState (current floor, direction, door), its request queue, movement
RequestFloor number plus type (hall call with direction, or cab call)
DoorOpen/close with safety checks
DisplayCurrent floor and direction indicators
Scheduler / DispatchStrategyDecides which elevator serves a hall call

Two classic design patterns fit naturally here, and naming them earns credit: the State pattern for elevator states (moving up, moving down, idle, doors open) and the Strategy pattern for swappable dispatch algorithms. Both are covered in our guide to the top must-know design patterns.

Step 3: The Scheduling Algorithm

This is the heart of the question. Naive first-come-first-served makes the elevator zigzag between floors. Real elevators use direction-based sweeping:

  • SCAN (the "elevator algorithm"): Keep moving in the current direction, serving every request along the way, until the end of the shaft, then reverse.
  • LOOK (what you should propose): Same as SCAN, but reverse as soon as there are no more requests ahead in the current direction, rather than traveling to the top or bottom floor.

With LOOK, the elevator maintains two sorted sets of stops: floors above it (served while going up) and floors below it (served while going down). A hall call going down is only served when the elevator is sweeping down past that floor.

Step 4: Implementation Example

Here is a simplified LOOK-style controller in Python. It keeps up-stops and down-stops separate and sweeps in one direction until that direction is exhausted:

class Elevator: def __init__(self, num_floors): self.num_floors = num_floors self.current_floor = 0 self.direction = 'idle' # 'up', 'down', or 'idle' self.up_stops = set() # floors to serve while going up self.down_stops = set() # floors to serve while going down def request(self, floor): """Handles both cab calls and hall calls.""" if floor > self.current_floor: self.up_stops.add(floor) elif floor < self.current_floor: self.down_stops.add(floor) def step(self): """Advance one floor and stop if this floor was requested.""" if self.direction == 'idle': if self.up_stops: self.direction = 'up' elif self.down_stops: self.direction = 'down' else: return if self.direction == 'up': self.current_floor += 1 if self.current_floor in self.up_stops: self.up_stops.remove(self.current_floor) self.open_doors() if not self.up_stops: # LOOK: reverse early self.direction = 'down' if self.down_stops else 'idle' elif self.direction == 'down': self.current_floor -= 1 if self.current_floor in self.down_stops: self.down_stops.remove(self.current_floor) self.open_doors() if not self.down_stops: self.direction = 'up' if self.up_stops else 'idle' def open_doors(self): print(f"Stopping at floor {self.current_floor}, doors open") elevator = Elevator(num_floors=10) elevator.request(3) elevator.request(7) while elevator.direction != 'idle' or elevator.up_stops or elevator.down_stops: elevator.step()

Step 5: Scaling to Multiple Elevators

Once the single-elevator design works, the interviewer will ask about a bank of elevators. Discuss the dispatch strategy:

  1. Nearest car: Assign each hall call to the elevator that can reach it soonest while moving in a compatible direction.
  2. Load balancing: Spread requests so one car does not absorb all traffic.
  3. Zoning: In tall buildings, dedicate elevators to floor ranges (for example, one bank serves floors 1-20, another 21-40) to cut travel time.
  4. Destination dispatch: Modern buildings ask for the destination floor in the lobby and group passengers heading to nearby floors into the same car.

Also worth mentioning: emergency behavior (return to ground floor on fire alarm), overload sensors blocking departure, and monitoring for maintenance.

How to Present This in an Interview

  1. Spend the first few minutes on requirements, especially hall calls vs. cab calls.
  2. Sketch the classes and name the State and Strategy patterns.
  3. Explain SCAN, then improve it to LOOK.
  4. Close with multi-elevator dispatch and safety handling.

Frequently Asked Questions

Is elevator design a low-level design (LLD) or high-level design (HLD) question? It is usually asked as low-level / object-oriented design: the interviewer wants classes, state transitions, and the scheduling algorithm rather than distributed-systems architecture.

Which algorithm do real elevators use? Variations of SCAN/LOOK with direction-based sweeping, and destination dispatch with passenger grouping in modern high-rises.

What design patterns apply to an elevator system? State (elevator states), Strategy (dispatch algorithms), Singleton (the system controller), and Observer (floor displays reacting to elevator movement).

Summary

A great elevator design answer is: clarified requirements, a small clean object model, the LOOK scheduling algorithm, and a dispatch strategy for multiple cars. Practice structuring answers like this in Grokking the Object Oriented Design Interview, which covers elevator-style OOD questions in depth, and Grokking the System Design Interview for the large-scale counterpart. For the reusable building blocks behind both, see System Design Patterns: From Fundamentals to Real Systems.

TAGS
System Design Interview
CONTRIBUTOR
Arslan Ahmad
Arslan Ahmad
ex-FAANG engineering manager and author or Grokking series.
-

GET YOUR FREE

Coding Questions Catalog

Design Gurus Newsletter - Latest from our Blog
Boost your coding skills with our essential coding questions catalog.
Take a step towards a better tech career now!
Explore Answers
What is the toughest challenge you faced interview?
How to understand concurrency models in programming languages?
What is the full form of GCP?
What is the highest salary of Dell?
What is the difference between weak and strong scaling?
What Is Saga Pattern?
Learn what the Saga pattern is in microservices, when to use it, examples, trade-offs, and interview tips. Perfect for system design interview prep.
Related Courses
Grokking the Coding Interview: Patterns for Coding Questions course cover
Grokking the Coding Interview: Patterns for Coding Questions
The 24 essential patterns behind every coding interview question. Available in Java, Python, JavaScript, C++, C#, and Go. The most comprehensive coding interview course with 543 lessons. A smarter alternative to grinding LeetCode.
4.6
Discounted price for Your Region

$197

Grokking Modern AI Fundamentals course cover
Grokking Modern AI Fundamentals
Master the fundamentals of AI today to lead the tech revolution of tomorrow.
4.1
Discounted price for Your Region

$72

Grokking Data Structures & Algorithms for Coding Interviews course cover
Grokking Data Structures & Algorithms for Coding Interviews
Unlock Coding Interview Success: Dive Deep into Data Structures and Algorithms.
Discounted price for Your Region

$78

Design Gurus logo
One-Stop Portal For Tech Interviews.
Copyright © 2026 Design Gurus, LLC. All rights reserved.