Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 357 Bytes

File metadata and controls

17 lines (14 loc) · 357 Bytes
fun maximizeGreatness(nums: IntArray): Int {
    val n = nums.size
    nums.sort()
    
    var great = 0
    for (i in 0 until n) {
        if (nums[great] < nums[i]) {
            great++
        }
    }
    return great
}