C++ || Priority Queue
Code\n\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        priority_queue<int> pq;\n        for(auto x:nums){\n            pq.pu
# Code\n```\nclass Solution {\npublic:\n    int maximizeGreatness(vector<int>& nums) {\n        priority_queue<int> pq;\n        for(auto x:nums){\n            pq.push(x);\n        }\n        sort(nums.rbegin(),nums.rend());\n        int res=0;\n        for(auto x:nums){\n            if(pq.top()>x){\n                pq.pop();\n                res++;\n            }\n        }\n        return res;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']