Problem 2592 · Medium

Maximize Greatness of an Array

Sort the values, then match each candidate against the smallest value it can still beat.

Open the interactive visualisation