Given the root of 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. Return the number of good nodes in the tree. The root is always good.
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.