Pregunta de entrevista de Block

LC easy/medium, not too difficult