Ezvor

1273. Delete Tree Nodes

MediumArray Preparing judge… LeetCode
ArrayTreeDepth-First SearchBreadth-First SearchDP on Trees

Hints

Hint 1
Traverse the tree using depth first search.
Hint 2
Find for every node the sum of values of its sub-tree.
Hint 3
Traverse the tree again from the root and return once you reach a node with zero sum of values in its sub-tree.