One line solution with detailed explanation
Obviously, we can try n=minutesToTest/minutesToDie times.\n\nOk, let's start with n=1, which means we can have only one try.\nIf we have k pigs, we can check 2*
Obviously, we can try `n=minutesToTest/minutesToDie` times.\n\nOk, let's start with `n=1`, which means we can have only one try.\nIf we have `k` pigs, we can check `2**k` buckets.\nTake `k=3` for example:\n1 - 001\n2 - 010\n3 - 011\n4 - 100\n5 - 101\n6 - 110\n7 - 111\n8 - 000\nThen, we can give `1+3+5+7` to pig 1, `2+4+6+7` to pig 2, `4+5+6+7` to pig 3, and if a pig dies, just put the bit to 1.\nIn this way, if `n==1`, k pigs can check `2**k` buckets.\n\nWhat if `n>=2`?\nIf we have `k` pigs, we can check `(n+1)**k` buckets.\nTake `n=2`, `k=1` for example: (base on 3)\n1 - 01\n2 - 02\n3 - 10\n4 - 11\n5 - 12\n6 - 20\n7 - 21\n8 - 22\n9 - 00\nAnd, at the first try, we can give `1+4+7` to the first pig, and `3+4+5` to the second pig, where the bit is 1; and at the second try, we can give `2+5+8` to the first pig, and `6+7+8` to the second pig, where the bit is 2.\nIn this way, we can check `(n+1)**k` buckets.\n\n\n***And in a word, if we have m buckets and n times to try, we just need to find the k, `(n+1)**k>=m`, and `k=ceil(log(n+1, m))`.*** That's the result we need.\n\nCode:\n```\npublic class Solution {\n    public int poorPigs(int buckets, int minutesToDie, int minutesToTest) {\n        return (int)Math.ceil(Math.log(buckets)/Math.log(minutesToTest/minutesToDie+1));\n    }\n}\n```\n\n\nAnd I don't think it's an easy question. It should at least be medium.
[]