Domanda di colloquio di Yahoo

Tree based Leet code style question