Compute sums and max path in N-ary tree | Uber Interview Question