buckets buckets of liquid, where exactly one of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have
minutesToTest minutes to determine which bucket is poisonous.
You can feed the pigs according to these steps:
minutesToDieminutes. You may not feed any other pigs during this time.
minutesToDieminutes have passed, any pigs that have been fed the poisonous bucket will die, and all others will survive.
minutesToTest, return the minimum number of pigs needed to figure out which bucket is poisonous within the allotted time.
Input: buckets = 1000, minutesToDie = 15, minutesToTest = 60 Output: 5
Input: buckets = 4, minutesToDie = 15, minutesToTest = 15 Output: 2
Input: buckets = 4, minutesToDie = 15, minutesToTest = 30 Output: 2
1 <= buckets <= 1000
1 <= minutesToDie <= minutesToTest <= 100