Pregunta de entrevista de Block

General coding question - medium difficulty