Simplest C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) \n    {\n        int res = 0 ;\n        sort(nums.begin(),nums.end());\n        int i  = 0 , j = 0; \n        while(i<nums.size() && j<nums.size())\n        {\n             while( i<nums.size() && j<nums.size() &&nums[i]>nums[j] )\n             {\n                 j++; \n                 i++;\n             }\n               if( i<nums.size() && j<nums.size() && nums[i]<=nums[j])\n               i++;\n        } \n\n        return  j;; \n        \n    }\n};\n```
['C++']