Dsa
Graphs Bfs
Easy
Elevator System
A multi-story building has elevators connecting floors. Some floors are not connected directly. You want to find the minimum number of elevator rides required to reach a target floor from a start floor. Input the building as a list of connected floors and a starting floor followed by a target floor. For example:
Input:
4
0 1
1 2
2 3
1
3
Output:
2
Key concepts
graphsbfssystem
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now