Schedule a Fulfillment Center Freight Elevator With the LOOK Algorithm

Last updated: November 29, 2026

Quick Overview

Implement the controller for a single freight elevator in a multi-floor fulfillment center. It receives floor requests at any time, moves one floor per tick, and serves requests in its current direction before reversing (LOOK). Return the order in which floors are served for a given request timeline.

Amazon
Software Engineering Fundamentals
Software Engineer
Amazon
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Implement the controller for a single freight elevator in a multi-floor fulfillment center. It receives floor requests at any time, moves one floor per tick, and serves requests in its current direction before reversing (LOOK). Return the order in which floors are served for a given request timeline.

An elevator design question with an algorithmic core, in the style of Amazon onsite low-level design rounds. Interviewers check clean separation of state (current floor, direction, pending requests), a correct direction policy, and testability through a deterministic tick simulation.

What the Interviewer Expects
  • Model state as floor, direction and a set of pending floors
  • Serve requests in the travel direction before reversing
  • Use sorted structures to find the next stop efficiently
  • Make the controller deterministic and tickable for tests
  • Discuss starvation and multi-elevator dispatch
Key Topics to Cover
Low-Level Design
Scheduling
Simulation
Sorted Sets
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you dispatch across four elevators?
  • How would you prioritize hazardous material loads?
  • How would you avoid starvation for a far floor under heavy traffic?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Floors are ints 0 to F. Requests are (tick, floor). Each tick the elevator moves one floor toward its target; arriving at a pending floor serves it at that tick (doors time ignored). Idle elevator pic...

High-Level Design
  • Elevator holds floor, direction (+1, -1, 0) and pending (a set).
  • request(floor) adds to pending; a request for the current floor while idle is served immediately.
  • step() per tick: if...

Submit Your Answer
Markdown supported