Ezvor

1973. Count Nodes Equal to Sum of Descendants

MediumTree Preparing judge… LeetCode
TreeDepth-First SearchBinary Tree

Hints

Hint 1
Can we reuse previously calculated information?
Hint 2
How can we calculate the sum of the current subtree using the sum of the child's subtree?