[C++] || Easy Solution using priority queue || 0 ms(Beats 100.00%) ✅
\n\n# Code\n\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        priority_queue<int> pq;\n        for(auto x:amount){\n            if(x
\n\n# Code\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        priority_queue<int> pq;\n        for(auto x:amount){\n            if(x)\n            pq.push(x);\n        }\n\n        int ans=0;\n\n        while(pq.size()>1){\n            int a=pq.top();\n            pq.pop();\n            int b=pq.top();\n            pq.pop();\n            if(a>1)\n                pq.push(a-1);\n            if(b>1)\n                pq.push(b-1);\n\n            ans++;\n        }\n\n        return pq.empty()?ans:ans+pq.top();\n    }\n};\n```
['Array', 'Heap (Priority Queue)', 'C++']