Problem 3997 · Medium

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.

Open the interactive visualisation