Compute subtree sums with tree DFS | Netflix Coding Question