Back to problems

Find the Second Minimum in a Tournament Tree

Algorithm · LinkedIn · Medium

A full binary tree is arranged like a single-elimination tournament bracket. Every internal node stores the smaller of its two children, so the root always holds the global minimum: $$ \text{node.val} = \min(\text{node.left.val}, \text{node.right.val}) $$ All leaves are competitors and are located at the same depth. Return the second smallest value in the multiset of leaf values. In other words, sort all leaf values and return the second element; if the minimum appears…

Checking your access…