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.
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.