NeetCode #441LC-1448MediumTreesNC 150NC 250
← Back to All Problems#441 · #1448 · Count Good Nodes in Binary Tree(统计二叉树中好节点的数目)
📌 Problem Statement & Constraints
Given a binary tree, a node
X is good if, on the path from the root to X, there is no node with a value greater than X.val. Return the number of good nodes. Constraints: the number of nodes is in [1, 10^5], -10^4 <= Node.val <= 10^4.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!