Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
What is the range that the answer must fall into?
The answer has to be in the range [0, max(buckets)] (inclusive).
For a number x, is there an efficient way to check if it is possible to make the amount of water in each bucket x.
Let in be the total amount of water that needs to be poured into buckets and out be the total amount of water that needs to be poured out of buckets to make the amount of water in each bucket x. If out - (out * loss) >= in, then it is possible.