Count Dominant Nodes in a Binary Tree
Work up a complete binary tree from its leaves. Each node carries the largest value in its subtree, and a node is dominant when its own value already equals that largest value.
Work up a complete binary tree from its leaves. Each node carries the largest value in its subtree, and a node is dominant when its own value already equals that largest value.