LinkedIn Interview Question

Build the tree from bottom to top