Problem 2792 · Medium

Count Nodes That Are Great Enough

Walk the tree bottom-up: each node gathers the values beneath it, counts how many are strictly smaller than itself, and counts the node when that tally reaches k.

Open the interactive visualisation