Bird
0
0

Which elevator should be assigned?

medium📝 Analysis Q13 of 15
LLD - Design — Elevator System
Consider a system with 2 elevators: Elevator A at floor 3 moving up with destinations [5, 7], Elevator B at floor 6 moving down with destinations [4, 2]. A request comes from floor 4 to go up. Which elevator should be assigned?
ANeither elevator
BElevator B
CEither elevator
DElevator A
Step-by-Step Solution
Solution:
  1. Step 1: Analyze elevator positions and directions

    Elevator A is at floor 3 going up; Elevator B is at floor 6 going down.
  2. Step 2: Match request direction and elevator direction

    Request is at floor 4 going up. Elevator A is below floor 4 and moving up, so it can pick up on the way. Elevator B is above floor 4 but moving down, so it cannot pick up going up.
  3. Final Answer:

    Elevator A -> Option D
  4. Quick Check:

    Elevator moving towards request floor in same direction = Elevator A [OK]
Quick Trick: Pick elevator moving towards request floor in same direction [OK]
Common Mistakes:
MISTAKES
  • Choosing elevator moving away from request
  • Ignoring elevator direction
  • Assuming either elevator works

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes