Pregunta de entrevista de BuyHatke

Explain an elevator algorithm and also write the code for it.