[LeetCode] Poor Pigs 可怜的猪

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Poor Pigs 可怜的猪相关的知识,希望对你有一定的参考价值。

 

There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 minutes. What is the minimum amount of pigs you need to figure out which bucket contains the poison within one hour.

Answer this question, and write an algorithm for the follow-up general case.

Follow-up:

If there are n buckets and a pig drinking poison will die within m minutes, how many pigs (x) you need to figure out the "poison" bucket within p minutes? There is exact one bucket with poison.

 

s

 

以上是关于[LeetCode] Poor Pigs 可怜的猪的主要内容,如果未能解决你的问题,请参考以下文章

Leetcode: Poor Pigs

[LeetCode] Poor Pigs

leetcode-458-Poor Pigs

leetcode 458. Poor Pigs

[LeetCode&Python] Problem 458. Poor Pigs

LeetCode 458. Poor Pigs