Pregunta de entrevista de Voleon

Common LC Medium question. Not too difficult.