1315. Sum of Nodes with Even-Valued Grandparent
Last updated
Last updated
https://leetcode.com/problems/sum-of-nodes-with-even-valued-grandparent
Given the root
of a binary tree, return the sum of values of nodes with an even-valued grandparent. If there are no nodes with an even-valued grandparent, return 0
.
A grandparent of a node is the parent of its parent if it exists.
Example 1:
Example 2:
Constraints:
The number of nodes in the tree is in the range [1, 104]
.
1 <= Node.val <= 100