✅🔥Just Priority Heap✅🔥
\uD83D\uDE09Don\'t just watch & move away, also give an Upvote.\uD83D\uDE09\n\n# Complexity\n- Time complexity: O(n.log(n))\n Add your time complexity here, e.g
# \uD83D\uDE09Don\'t just watch & move away, also give an Upvote.\uD83D\uDE09\n\n# Complexity\n- Time complexity: $$O(n.log(n))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        priority_queue<int> pq;\n\n        pq.push(amount[0]);\n        pq.push(amount[1]);\n        pq.push(amount[2]);\n\n\n        int time = 0,first = 0, second = 0;\n        while(pq.top() != 0)\n        {\n            time++;\n\n            if(pq.top() != 0){\n                first = pq.top();\n                pq.pop();\n                first--;\n            }\n\n            if(pq.top() != 0){\n                second = pq.top();\n                pq.pop();\n                second--;\n            }\n\n            pq.push(first);\n            pq.push(second);\n            \n        }\n\n\n<!-- \u2705Well before returning answer don\'t forget to UPVOTE.\u2705 -->\n        return time;\n    }\n};\n```\n![Leetcode Upvote.gif](https://assets.leetcode.com/users/images/ddb58277-f81d-40f9-927f-046720177d8e_1683052648.39132.gif)
['C', 'Heap (Priority Queue)', 'C++', 'Java']