Yahoo Interview Question

Tree based Leet code style question