Microsoft Interview Question

Binary Tree problem. Medium difficulty