Given the root of a binary tree and an integer k, a node is considered great enough if its subtree contains at least k nodes with values strictly less than node.val.
Return the total number of great enough nodes in the binary tree.
Note: A subtree of a
nodeconsists of thatnodeand all of its descendants.
Constraints:
The number of nodes in the tree is in the range
Node.val
k
Given the root of a binary tree and an integer k, a node is considered great enough if its subtree contains at least k nodes with values strictly less than node.val.
Return the total number of great enough nodes in the binary tree.
Note: A subtree of a
nodeconsists of thatnodeand all of its descendants.
Constraints:
The number of nodes in the tree is in the range
Node.val
k