1973. Count Nodes Equal to Sum of Descendants
Previous1972. First and Last Call On the Same DayNext1974. Minimum Time to Type Word Using Special Typewriter
Last updated
Last updated
**Input:** root = [10,3,4,2,1]
**Output:** 2
**Explanation:**
For the node with value 10: The sum of its descendants is 3+4+2+1 = 10.
For the node with value 3: The sum of its descendants is 2+1 = 3.**Input:** root = [2,3,null,2,null]
**Output:** 0
**Explanation:**
No node has a value that is equal to the sum of its descendants.**Input:** root = [0]
**Output:** 1
For the node with value 0: The sum of its descendants is 0 since it has no descendants.