orders of three numbers: orders[0] is the number of coffee cups ordered, orders[1] is tea and orders[2] is cocoa. Return the minimum number of seconds the machine needs to serve every order.orders=[3, 1, 2] → 3
There are 6 cups in total and at most two can be filled per second, so at least 3 seconds are needed. Three is enough: coffee+tea, coffee+cocoa, coffee+cocoa.
orders=[1, 6, 2] → 6
Six cups of tea are needed and two cups of tea can never be poured in the same second, so it takes at least 6 seconds. The other 3 cups are poured alongside the tea.
orders=[0, 0, 0] → 0
orders=[3, 1, 2]
3
Run checks the first 3 tests in your browser. Submit checks all 180 tests on the server, hidden ones included.