Pregunta de entrevista de Amazon

Asked me to solve a puzzle