[C++] 2 Method { (maximum of max and sum ) + (Sorting decreasing order) }
But I haven\'t solved in contest, very disappointed\nNow i have 2 method ;\n1 Method:\n\nclass Solution {\npublic:\n    int fillCups(vector<int>& a)\n    {\n   
But I haven\'t solved in contest, very disappointed\nNow i have 2 method ;\n1 Method:\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& a)\n    {\n        int sum=0;\n        for(auto e:a)\n        {\n            sum+=e;\n        }\n        return max(*max_element(a.begin(),a.end()),(sum+1)/2);\n    }\n};\n```\n2 Method:\nSorting decreasing order and check first element\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& a)\n    {\n        sort(a.begin(),a.end(),greater<int>());\n        int count=0;\n        while(a[0]>0)\n        {\n            a[0]--;\n            a[1]--;\n            count++;\n            sort(a.begin(),a.end(),greater<int>());\n        }\n        return count;\n    }\n};\n```
[]