Pregunta de entrevista de Apple

Not difficult or anything unexpected