Sum of Nodes with Even-Valued Grandparent
Last updated
Last updated
Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it exists.)
If there are no nodes with an even-valued grandparent, return 0
.
Example 1:
Constraints:
The number of nodes in the tree is between 1
and 10^4
.
The value of nodes is between 1
and 100
.