SORT || TWO POINTERS || C++ || SORT & SWEET || EASY TO UDERSTAND
\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        int ans = 0;\n        int i = 0, j = 0, n = nums.size();\n        sort(nums
```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        int ans = 0;\n        int i = 0, j = 0, n = nums.size();\n        sort(nums.begin(),nums.end());\n        while(i<n&&j<n){\n            while(j<n&&nums[j]<=nums[i]){\n                j++;\n            }\n            i++;\n            if(j==n)break;\n            j++;\n            ans++;\n        }\n        return ans;\n    }\n};```
['Two Pointers', 'C', 'Sorting', 'C++']