Design software to control an elevator system in a building
Anonimo
Classic tech interview question that I've seen and have been asked myself a number of times. My standard approach to this usually involves creating "elevator" objects with a "elevator manager" to ask each of these objects useful questions, like "what floor are you next heading to and in what direction?" and "how far are you from a possible stop on floor X?" (i.e. can't brake the cab suddenly if less than X floors away; passengers can get scrambled). And of course the elevator manager manages stop requests from each floor. There's a bit more detail to draw out on the white board, including some pseudo code. No idea if the guy interviewing me actually liked what he was seeing.