Elevator System Design — A tricky technical interview question
An Elevator System Design interview question is one of the best interview questions to gauge the candidate’s grasp on the fundamentals of Computer Science. In addition, this can be extended in many different directions, making it an ideal problem to see how the candidate thinks. It’s easy to make it an object-oriented design problem. It can be used to discuss different data structures that will help in the implementation. If needed, it can be made even more complicated by adding multiple elevators serving the building, where a request button summons the most appropriate elevator. That is another nice optimization problem. But the core single elevator problem is often good enough to judge the ability of a candidate to see different trade-offs inherent in any design.
Requirements:
As always when an interviewer asks this question, it is always better to first understand what he is really looking for in the candidate. The best way to find out is to collect the requirements first.
1. An elevator can move up, down or standstill.
2. An elevator can transfer passengers from one floor in a building to another floor in the minimum time possible.
3. Elevator door can only open when it is standstill in a floor (i.e. not moving).