← All problems
Count Good Nodes in Binary Tree
Count nodes where the path from root contains no greater value.
Complexity
Time O(n), Space O(h)
Common pitfalls
- Using global max instead of path max
- Strict vs non-strict comparison
Your solution
Log in to save your code and track progress.