Java Code with Detailed Explanations
\n Explanations:\nFor one pig, it can make at most minutesToTest / minutesToDie tests.\nAnd, there are at most minutesToTest / minutesToDie + 1 states. (may die
\n* Explanations:\nFor one pig, it can make at most **minutesToTest / minutesToDie** tests.\nAnd, there are at most **minutesToTest / minutesToDie + 1** states. (may die in each test or alive after all tests)\nWe assume there are n pigs, then there are **(minutesToTest / minutesToDie + 1) ^ x** states in total\nWe aim to find the minimum x such that **(minutesToTest / minutesToDie + 1) ^ x >= buckets**\n\n* The change of base rule :\n![image](https://s3-lc-upload.s3.amazonaws.com/users/mengcareers/image_1526680819.png)\n\n* Java Math.log :\nMath.log(double a) : return the natural logarithm (base e) of a double value.\n\n```\nimport static java.lang.Math.ceil;\nimport static java.lang.Math.log;\nclass Solution {\n    public int poorPigs(int buckets, int minutesToDie, int minutesToTest) {\n        return (int) ceil(log(buckets) / log(minutesToTest / minutesToDie + 1));\n    }\n}\n```
[]