2273. Pour Water Between Buckets to Make Water Levels Equal

Medium
Array
Binary Search

Description

Hints

Hint 1
What is the range that the answer must fall into?
Hint 2
The answer has to be in the range [0, max(buckets)] (inclusive).
Hint 3
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.
Hint 4
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.

Statistics

Acceptance
67.9%
Submissions
5,394
Accepted
3,662