Poor Pigs | Easiest Solution | 0ms | Java ✅ | C++
Please Upvote\n\n\n\n\n# Code in JAVA\n\nclass Solution\n{\n    public int poorPigs(int buckets, int tdie, int ttest)\n    {\n        int test = ttest/tdie;\n  
# Please Upvote\n\n\n![image.png](https://assets.leetcode.com/users/images/30ad39ad-7591-41d2-8289-4dc047b9b254_1698545020.715449.png)\n\n# Code in JAVA\n```\nclass Solution\n{\n    public int poorPigs(int buckets, int tdie, int ttest)\n    {\n        int test = ttest/tdie;\n        int i=0;\n        while(Math.pow(test+1,i)< buckets)\n        {\n            i++;\n        }\n        return i;\n    }\n}\n```\n\n# Code in C++\n```\nclass Solution \n{\npublic: int poorPigs(int buckets, int timeDetect, int timeTest)\n{\n    return ceil(log2(buckets)/log2(int(timeTest/timeDetect)+1));\n}\n};\n\n```
['C++', 'Java']