Leetcode 1273. Delete Tree Nodes
Given a rooted tree (via a parent array) and values for each node, remove all subtrees whose total node-sum equals zero (deletions cascade) and return the count of remaining nodes; the core challenge is computing subtree sums with a postorder DFS and pruning based on those sums.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.