mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-07 18:10:29 +08:00
add: leetcode 0458 solution
This commit is contained in:
8
leetcode/0458.Poor-Pigs/458.Poor Pigs.go
Normal file
8
leetcode/0458.Poor-Pigs/458.Poor Pigs.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package leetcode
|
||||||
|
|
||||||
|
import "math"
|
||||||
|
|
||||||
|
func poorPigs(buckets int, minutesToDie int, minutesToTest int) int {
|
||||||
|
base := minutesToTest/minutesToDie + 1
|
||||||
|
return int(math.Ceil(math.Log10(float64(buckets)) / math.Log10(float64(base))))
|
||||||
|
}
|
Reference in New Issue
Block a user