Pregunta de entrevista de Amazon

One question from array and another from tree