C++ | using max and sort greater
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 fillCups(vector<int>& amount) {\n        int ans = 0;\n        while(amount.size() > 2) {\n            sort(amount.begin(), amount.end(), greater<int>());\n            if(amount[2] == 0) {\n                amount.pop_back();\n            } else {\n                amount[0]--;\n                amount[2]--;\n                ans++;\n            }\n        }\n        return ans + max(amount[0], amount[1]);\n    }\n};\n```
['C++']