Javascript
\nvar fillCups = function(amount) {\n    let total = 0;\n    let max = 0;\n    for (let i = 0; i < amount.length; i++) {\n        max = Math.max(max, amount[i])
```\nvar fillCups = function(amount) {\n    let total = 0;\n    let max = 0;\n    for (let i = 0; i < amount.length; i++) {\n        max = Math.max(max, amount[i]);\n        total += amount[i];\n    }\n\t\n\t// if max cups bigger or equal to the sum of remain two smaller cups, then max cups will cover all number of cups we needed.\n    if (max >= total - max) return max;\n    return Math.ceil(total / 2);\n};\n```
['JavaScript']