C++ 100% Faster
Let\'s take an example \ni/p :\namount = [2,3,9]\nIn this example, instead of calculating all the calculations, I just took the addition of all elements if that
Let\'s take an example \ni/p :\namount = [2,3,9]\nIn this example, instead of calculating all the calculations, I just took the addition of all elements if that is less than a maximum element of the amount, then return the maximum element of the amount vector.\ni/p :\namount = [8,9,13]\nIn this example, the sum of the first two elements is greater than the maximum element, so I took the addition of all elements, if it is odd then just return (sum / 2) + 1, else return sum/2.\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) \n    {\n        sort(amount.begin(), amount.end());\n        if(amount[0] + amount[1] <= amount[2])\n            return amount[2];\n        else\n        {\n            int cnt = amount[0] + amount[1] + amount[2];\n            if(cnt % 2 == 1)\n            {\n                return (cnt/2) + 1;\n            }\n            else\n            {\n                return cnt/2;\n            }\n        }\n    }\n};\n```
['C']