Pregunta de entrevista de Yahoo

Tree based Leet code style question