+ 9
CHALLENGE : Bucket Problem
There are infinite no of buckets and N no of water. This bucket have a unique property . The capacity of ith bucket is ith liters i.e.capacity of 1st bucket is 1 liter the capacity of 2nd bucket is 2 liters. Also the ith bucket can only be filled when all the buckets which have lesser capacity are totally filled i.e 2nd bucket can not be filled before 1st bucket. take the amount of water as input and find the no of buckets to be filled by the amount of water.
5 Answers
+ 17
1-liner method
//2.5 lites will fill 1.75 bucket(s) @Nomeh âș
https://code.sololearn.com/cAYxf3Egtmw4/?ref=app
+ 4
could I say that 2.5ltrs of water can fill 1 bucket or 2 buckets?
+ 4
I overly complicated the whole thing, I think, but I wanted to play with classes, so there it is.
https://code.sololearn.com/cuoQtj9N1U8J/#py