Implement getElevator() and nextFloor() for a multi-elevator system
Given a list of elevators, each with a current floor and direction, implement two methods: getElevator(userFloor, destinationFloor) that selects the best elevator to serve a user on a given floor, and nextFloor() that advances an elevator to its next destination floor.
Asked at:
Pinterest
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early August, 2026
Pinterest
Mid-level
Mid April, 2026
Pinterest
Senior
Mid July, 2025
Pinterest
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.