解题思路
参考这篇博客。
$ n = \frac{minutesToTest}{minutesToDie} $ $ m = buckets $ $ \log_nm = \frac{\log_2m}{\log_2n} $func poorPigs(buckets int, minutesToDie int, minutesToTest int) int {
return int(
math.Ceil(
math.Log(float64(buckets)) / math.Log(float64(minutesToTest) / float64(minutesToDie) + 1)
)
)
}
留言