1448. Count Good Nodes in Binary Tree
Count Good Nodes in Binary Tree - LeetCode 주어진 이진 트리에서 좋은 노드를 찾고, 좋은 노드의 개수를 반환하세요. 이 문제에서 좋은 노드는 다음과 같이 정의됩니다: 루트 노드부터 해당 노드까지의 경로 상에서 해당 노드의 값보다 큰 값을 가진 노드가 없는 노드입니다. 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. Example 1: Input: root = [3,1,4,3,null..
LeetCode
2023. 10. 26. 23:30