0458.cpp (221B)
1 class Solution { 2 public: 3 int poorPigs(int buckets, int minutesToDie, int minutesToTest) const { 4 const int tests = minutesToTest / minutesToDie + 1; 5 return ceil(log2(buckets) / log2(tests)); 6 } 7 };