LLD - Design — Elevator SystemHow can an elevator state machine handle simultaneous requests from multiple floors efficiently?ABy randomly selecting a floor to visit nextBBy ignoring all requests except the first oneCBy maintaining a queue of floor requests and prioritizing based on current directionDBy resetting to Idle after each requestCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand multiple request challengeElevator must decide order to serve floors efficiently without unnecessary movement.Step 2: Use queue and prioritizationMaintaining a queue and prioritizing requests in current direction reduces wait time and travel.Final Answer:By maintaining a queue of floor requests and prioritizing based on current direction -> Option CQuick Check:Queue and priority [OK]Quick Trick: Queue requests and prioritize direction [OK]Common Mistakes:MISTAKESIgnoring requests after firstRandom floor selectionResetting state too often
Master "Design — Elevator System" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Behavioral Design Patterns — Part 1 - State pattern - Quiz 14medium Behavioral Design Patterns — Part 1 - Observer pattern - Quiz 6medium Behavioral Design Patterns — Part 1 - Command pattern - Quiz 15hard Design — Elevator System - State management (idle, moving up, moving down) - Quiz 1easy Design — Library Management System - Why library management tests CRUD design - Quiz 1easy Design — Library Management System - Why library management tests CRUD design - Quiz 5medium Design — Library Management System - Notification system - Quiz 12easy Design — Parking Lot System - Why parking lot is a classic LLD problem - Quiz 8hard Design — Tic-Tac-Toe Game - Extensibility (NxN board, multiple players) - Quiz 5medium Design — Tic-Tac-Toe Game - Player turn management - Quiz 1easy