We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0073c7b commit df6e87cCopy full SHA for df6e87c
C++/poor-pigs.cpp
@@ -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