Pregunta de entrevista de Motadata

tree based question and other one is map based.