C++ solution; 100% faster with some some explaination
\nclass Solution {\npublic:\n    \n    int poorPigs(int b, int md, int mt) {\n        \n            // if x is a min number of pigs then for 1 tests answer we c
```\nclass Solution {\npublic:\n    \n    int poorPigs(int b, int md, int mt) {\n        \n            // if x is a min number of pigs then for 1 tests answer we can say that:\n            //     2^x >= buckets\n            //    so x >= log2(buckets)\n            //       x = ceil(log2(buckets))\n            // how??\n            //  1 tests we can say for 2 buckets:\n            //       p0    // 1 pig for 2 buckets\n            //  b0 - 0      \n            //  b1 - 1\n            //  \n            //      p0 p1  // 2pigs for 4 buckets\n            //  b0 - 0 0\n            //  b1 - 0 1\n            //  b2 - 1 0\n            //  b3 - 1 1\n            // if p0 dies = b2 is poisonous\n            // if p1 dies = b1 is poisonous\n            // if both dies = b3 is poisonous\n            // if no one dies = b0 is poisonous\n        \n            // similarly 3 pigs for 8 buckets\n            // so generaly for 2^x buckets we need atmost x pigs \n        \n            // for 2 tests ans:\n            //      3^x >= buckets (3 choices 0,1,2)\n            // like for 2 pigs we need 3^2 buckets = 9;\n            //          p0 p1 \n            //  b0 -    0  0  \n            //  b1 -    0  1    // 1 shows that drink b1 bucket to p1 pig during first test \n            //  b2 -    0  2    //  2shows that drink p1 pig in second test\n            //  b3 -    1  0   \n            //  b4 -    1  1 \n            //  b5 -    1  2 \n            //  b6 -    2  0\n            //  b7 -    2  1 \n            //  b8 -    2  2\n                \n            int tests = mt/md + 1;\n        \n            return ceil(log(b)/log(tests));\n            \n        \n    }\n};\n```
[]