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.

Constraints:
- The number of nodes in the binary tree is in the range
[1, 10^5]
.
- Each node's value is between
[-10^4, 10^4]
.
풀이
효성
깨달은 것 : 자식 노드의 max값은 return 되어 사라진다!