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
November 29, 20260
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
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- 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 ProblemsSample 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
Elevatorholdsfloor,direction(+1, -1, 0) andpending(a set).request(floor)adds to pending; a request for the current floor while idle is served immediately.step()per tick: if...