/*
* @lc app=leetcode.cn id=2335 lang=typescript
*
* [2335] 装满杯子需要的最短总时长
*/
// @lc code=start
function fillCups(amount: number[]): number {}
// @lc code=end
function fillCups(amount: number[]): number {
amount.sort((a, b) => a - b)
const [a, b, c] = amount
if (a + b >= c) return Math.ceil((a + b + c) / 2)
return c
}
test.each([
{ input: { amount: [1, 4, 2] }, output: 4 },
{ input: { amount: [5, 4, 4] }, output: 7 },
{ input: { amount: [5, 0, 0] }, output: 5 },
])('input: amount = $input.amount', ({ input: { amount }, output }) => {
expect(fillCups(amount)).toEqual(output)
})