1448. Leetcode Count Good Nodes in Binary Tree || Intuition + Explanation + Code

preview_player
Показать описание
Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.

Return the number of good nodes in the binary tree.
Рекомендации по теме
Комментарии
Автор

What is a good node?
“Good node is a node which is good”

paruchurisaisuhas
Автор

The code is wrong the return type on countgoodnodes is void so how can we return a variable from that function

ashishvats
Автор

Can you plz explain the backtracking step in the comments

smartswaggy
visit shbcf.ru