🟢🔴🟢 Beats 100.00%👏 Two Pointer Approach 🟢🔴🟢

```
class Solution {
  int maximizeGreatness(List<int> nums) {
    
    nums.sort();
    int i = 0;
    int j = 0;
    int count = 0;
    while(j < nums.length){
        if(nums[i] < nums[j]){
            i++;
            count++;
        }
        j++;
    }
    return count;

  }
}
```
['Python', 'C++', 'Java', 'JavaScript', 'C#', 'Dart']