Skip to content

Latest commit

 

History

History

pour-water-between-buckets-to-make-water-levels-equal

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Related Topics

[Array] [Binary Search]

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.