458. Poor Pigs Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6class Solution { public: int poorPigs(int buckets, int minutesToDie, int minutesToTest) { return ceil(log(buckets) / log(minutesToTest / minutesToDie + 1)); } }; 1 2 3 4 5class Solution { public int poorPigs(int buckets, int minutesToDie, int minutesToTest) { return (int) Math.ceil(Math.log(buckets) / Math.log(minutesToTest / minutesToDie + 1)); } } 1 2 3class Solution: def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int: return math.ceil(log(buckets) / log(minutesToTest // minutesToDie + 1))