Simple Python solution with explanation
Sort the list. \nEvery time take two max numbers and decrement them by one. Also increment count by one. \nIf only one non zero element present then add that nu
Sort the list. \nEvery time take two max numbers and decrement them by one. Also increment count by one. \nIf only one non zero element present then add that number to count and return the count. \nIf all are zero then return count. \n\n```\nimport math\nclass Solution:\n    def fillCups(self, l: List[int]) -> int:\n        l.sort()\n        c=0\n        while(sum(l)!=0):\n            if(l[-1]!=0 and l[-2]!=0):\n                l[-1]-=1\n                l[-2]-=1\n                c+=1\n\t\t\t\t\n\t\t\t# If only one non zero element present then add that number to count and return the count.\n            elif(l[-2]==0 and l[-3]==0):\n                return c+l[-1]\n\t\t\t\t\n\t\t\t#If all are zero then return count\n            elif(sum(l)==0):\n                return c\n            \n            l.sort()\n        return c\n```\n\nupvote if you like it
['Array', 'Greedy', 'Sorting', 'Python', 'Python3']