Bird
0
0

Which elevator should be assigned?

medium📝 Analysis Q4 of 15
LLD - Design — Elevator System
Given two elevators: Elevator 1 at floor 2 moving up with destinations [5, 8], Elevator 2 at floor 6 moving down with destinations [3, 1]. A request comes from floor 4 to go up. Which elevator should be assigned?
AEither elevator
BElevator 2
CElevator 1
DNeither elevator
Step-by-Step Solution
Solution:
  1. Step 1: Analyze elevator positions and directions

    Elevator 1 is below floor 4 and moving up, so it can pick up at floor 4 on its way.
  2. Step 2: Evaluate Elevator 2

    Elevator 2 is above floor 4 but moving down, so it would need to reverse direction to pick up at floor 4.
  3. Final Answer:

    Elevator 1 -> Option C
  4. Quick Check:

    Best elevator = Elevator 1 [OK]
Quick Trick: Choose elevator moving towards request floor [OK]
Common Mistakes:
MISTAKES
  • Ignoring elevator direction
  • Choosing elevator farther away
  • Assuming either elevator works

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes