Skip to content

Commit 1364317

Browse files
authored
Create Solution.java
1 parent 6fcc206 commit 1364317

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

solution/0458.Poor Pigs/Solution.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int poorPigs(int buckets, int minutesToDie, int minutesToTest) {
3+
int base = minutesToTest / minutesToDie + 1;
4+
int res = 0;
5+
int p = 1;
6+
while (p < buckets) {
7+
p *= base;
8+
++res;
9+
}
10+
return res;
11+
}
12+
}

0 commit comments

Comments
 (0)