simple two pointers || easy to understand || must see
Code\n\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) \n    {\n         sort(nums.begin(),nums.end());\n         int start = 0;\n     
# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) \n    {\n         sort(nums.begin(),nums.end());\n         int start = 0;\n         int end   = 0;\n\n         int count = 0;\n         while(end < (nums.size()))\n         {\n             while(end < nums.size() and nums[end] <= nums[start])\n             {\n                 end++;\n             }\n             if(end < nums.size())\n             {\n                 count++;\n                 start++;\n                 end++;\n             }\n         }\n         return count;\n    }\n};\n```
['Two Pointers', 'Greedy', 'Sorting', 'C++']