Leetcode: 458. Poor Pigs

Problem Statement

from math import comb


class Solution:
    def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int:
        digits = ceil(minutesToTest / minutesToDie + 1)
        cur = 1
        ans = 0
        while cur < buckets:
            cur *= digits
            ans += 1
        return ans


assert Solution().poorPigs(1000, 15, 60) == 5
assert Solution().poorPigs(4, 15, 15) == 2
assert Solution().poorPigs(4, 15, 30) == 2