diff options
Diffstat (limited to 'other/poor-pigs.cpp')
-rw-r--r-- | other/poor-pigs.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/other/poor-pigs.cpp b/other/poor-pigs.cpp new file mode 100644 index 0000000..7455583 --- /dev/null +++ b/other/poor-pigs.cpp @@ -0,0 +1,8 @@ +#include "leetcode.h" + +class Solution { +public: + int poorPigs(int buckets, int poisonTime, int totalTime) { + return ceil(log(buckets) / log(totalTime / poisonTime + 1)); + } +}; |