The interviewer literally said at some point that the question was too open-ended, which was both reassuring and kind of unsettling.
Start by clarifying requirements and defining the system's scope, then design the core classes and interfaces for a single elevator before extending to multiple elevators. Discuss scheduling strategies (fairness-first vs. path-first) and their trade-offs, and explain how you would coordinate multiple elevators to optimize overall efficiency.
Pro tip: Explicitly state your assumptions (e.g., elevator capacity, speed, number of floors) and treat the design as iterative—start simple and refine based on feedback. This shows you can handle ambiguity and collaborate effectively.
Ask questions to understand constraints: number of elevators, floors, capacity, speed, and expected load. Define functional and non-functional requirements (e.g., latency, fairness, energy efficiency).
Identify key entities: Elevator, Request, Controller, Scheduler. Define their responsibilities and interactions. For a single elevator, outline methods like requestElevator(floor, direction) and step().
Compare fairness-first (e.g., FCFS, round-robin) vs. path-first (e.g., SCAN, LOOK) scheduling. Discuss trade-offs: fairness reduces starvation but may increase average wait time; path-first optimizes throughput but can starve distant requests.
Propose a central controller or distributed approach. Use strategies like zone-based assignment, nearest-elevator, or load balancing. Discuss communication and state sharing between elevators.
Summarize key decisions and their implications. Mention how to handle edge cases (e.g., emergency, maintenance) and how the design can scale or adapt to changing requirements.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.