Pregunta de entrevista de 1stDibs.com

How would you design an elevator?

Respuesta de la entrevista

Anónimo

1 sept 2018

I worked on paper and wrote some psuedo-Swift code, but as I felt like I was taking a bit too long, I mostly verbally explained my thoughts to my interviewers. My basic solution was to create an Elevator class that would have properties that represent its direction (up/down), its current floor, and a queue of floors to visit. That class then needed methods to add floors to the queue depending on the direction of travel and the current floor. I also discussed my idea for an ElevatorBank class which would contain multiple elevators, and call the nearest one. My solutions weren't fully implemented, but my interviewers were mainly interested in hearing me discuss the various complexities of the problem and how I would handle them.