Skip to content

Commit df6e87c

Browse files
authored
Create poor-pigs.cpp
1 parent 0073c7b commit df6e87c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

C++/poor-pigs.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Time: O(1)
2+
// Space: O(1)
3+
4+
class Solution {
5+
public:
6+
int poorPigs(int buckets, int minutesToDie, int minutesToTest) {
7+
return ceil(log(buckets) / log(minutesToTest / minutesToDie + 1));
8+
}
9+
};

0 commit comments

Comments
 (0)