LeetCode 315 | Sum of Nodes with Even-Valued Grandparent | Solution Explained (Java + Whiteboard)

preview_player
Показать описание
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.

Running Time: O(N)
Space Complexity: O(N)

Always be pluggin:
Рекомендации по теме
Комментарии
Автор

liked this video because of intro song

NitinSinghMinVlogs
Автор

Where did you define sum in the dfs() method?

HenggaoCai