C++ || Two Pointers
Complexity\n- Time complexity: O(nlogn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
## Complexity\n- Time complexity: $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        int cnt=0;\n        int i=0;\n        for (int select=1; select<nums.size(); select++){\n            if (nums[i]<nums[select]){\n                i++; cnt++;\n            }\n        }\n        return cnt;\n    }\n};\n```
['Array', 'Two Pointers', 'Greedy', 'Sorting', 'C++']