javascript greedy 113ms
Main idea: each time needs to remove the max count of two color(to make as much as double color being removed per step), until there is only one color left\n\nc
Main idea: each time needs to remove the max count of two color(to make as much as double color being removed per step), until there is only one color left\n```\nconst fillCups = (a) => {\n    let res = 0;\n    while (!valid(a)) {\n        a.sort((x, y) => x - y);\n        if (a[1] > 0) { // can make two color remove\n            a[2]--;\n            a[1]--;\n            res++;\n        } else { // only one color left\n            res += a[2];\n            break;\n        }\n    }\n    return res;\n};\n\nconst valid = (a) => a.every(x => x <= 0);\n```
['JavaScript']