Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Traverse the tree using depth first search.
Find for every node the sum of values of its sub-tree.
Traverse the tree again from the root and return once you reach a node with zero sum of values in its sub-tree.