Given the root of a binary tree, return the number of nodes where the value of the node equals the total sum of the values of all its descendants.
A descendant of a node is any node situated strictly below it along a path leading to a leaf node. A node with no descendants has a descendant sum of
Note: A node is not considered a descendant of itself.
Constraints:
The number of nodes in the tree is in the range [
Node.val
Given the root of a binary tree, return the number of nodes where the value of the node equals the total sum of the values of all its descendants.
A descendant of a node is any node situated strictly below it along a path leading to a leaf node. A node with no descendants has a descendant sum of
Note: A node is not considered a descendant of itself.
Constraints:
The number of nodes in the tree is in the range [
Node.val