You are given a 2-D grid representing two elevators (left elevator A, right elevator B).
Each cell may contain a digit representing the number of people waiting on that floor for that elevator.
Example grid:
[A] [B]
|1 2 3|
|4 5 6|
|7 8 #|
[C] [D]
Legend:
- Column A = left elevator
- Column B = right elevator
- Numbers = number of people waiting
#= no service / broken panel- Floors go from bottom to top
You are also given a query describing a request:
7#3 → going to the 7th floor with 3 people
Task
Given the grid and a request in the format:
<target-floor>#<people-count>
Write a function that determines:
- Which elevator (A or B) should serve the request
- Whether that elevator has enough capacity
- Return the total number of people currently waiting along the path to the target floor
You may assume:
- Floor numbers correspond to rows in the grid
- Elevators serve straight vertical paths
- If a floor contains
#, that elevator cannot serve that floor - If both elevators can serve the floor, choose the one with fewer total waiting people
Given a grid where each column represents an elevator and each cell shows people waiting (or # for blocked floors), determine:
- Which elevator can reach the target floor
- Total number of waiting people on its path
- If both can reach, choose the one with fewer total waiting people
The request format F#N means N people want to go to floor F.
The VOprep team has long accompanied candidates through various major company OAs and VOs, including OpenAI, Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Stripe or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.