C++ || Detail Explanation || 1 Line Code|| 100% Fast
Explanation:\n\n\tThis question is based on combinatrics. \n\t\n\tLets assume that we have p pigs which can give us the accurate result. Now we have\n\ttotal Ro
Explanation:\n\n\tThis question is based on combinatrics. \n\t\n\tLets assume that we have p pigs which can give us the accurate result. Now we have\n\ttotal Round of test = (timetoTest/TimetoDie) ie. T tests. \n\t\n\tSo for each T test there can be T+1  outcomes that is it can die in 1st or 2nd or Tth oit it means the T cases and the last case is it won\'t die! So total T+1 Outcomes are possible.\n\t\n\tNow for each pig we have to go for T+1 outcomes i.e\n\t(T+1)*(T+1)........*(T+1).\n\t\n\tSo T+1 tests rounds are there so for all p pigs the total combination will be (T+1) to the power p i.e (T+1)^p. Now** this total combination should be greater than or equal to N.**\n\t\n\tHence  the condition for the answer is going to be \n\t(T+1)^p >= N\n\tTaking log on both sides we will get the required answee\n\tp >= log(N)/ log(T+1);\n\tand hence ceil function is used in the return.\n\n**PLEASE DO UPVOTE**\n\n\tclass Solution {\n\tpublic:\n\n    int poorPigs(int buckets, int poisonTime, int totalTime) {\n        return ceil(log(buckets) / log(totalTime / poisonTime + 1));\n    }\n\t};\n\n**PLEASE DO UPVOTE**
['C']