Pregunta de entrevista de Allen Institute

Asked a tree question from leetcode.