✅ SIMPLE C++ SOLUTION || WELL COMMENTED || USING PRIORITY QUEUE
Code\n\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        int seconds = 0;\n        priority_queue<int> pq;\n        // pushing all th
# Code\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        int seconds = 0;\n        priority_queue<int> pq;\n        // pushing all three amount in max heap\n        pq.push(amount[0]);\n        pq.push(amount[1]);\n        pq.push(amount[2]);\n        // increase the seconds while any cup is left\n        while(pq.top()>0){\n            // check the 1st cup \n            int first;\n            first = pq.top();\n            pq.pop();\n            int second;\n            // if 2nd cup is left then fill both the cup which take one second\n            if(pq.top()>0){\n                second = pq.top();\n                pq.pop();\n            }\n            else{\n                // if only single type of cup is left than consider one second for each cup\n                // and add it to the seconds \n                if(first>0)\n                    seconds+=first;\n                break;\n            }\n            pq.push(first-1);\n            pq.push(second-1);\n            seconds++;\n        }\n        return seconds;\n    }\n};\n```
['C++']