[C++/Python/Picture] 1-line greedy solution with N-dimension puzzle cube scan
Idea:\nExample 1: What is the minimal number of pigs are needed to test 9 bucteks within 2 rounds:\n1  2  3\n4  5  6\n7  8  9\nAnswer: 2.\nWhy?  \nPig 1 scan ho
**Idea:**\nExample 1: What is the minimal number of pigs are needed to test 9 bucteks within 2 rounds:\n1  2  3\n4  5  6\n7  8  9\nAnswer: 2.\nWhy?  \nPig 1 scan horizontally row by row        and will spot the row       contains poinson after 2 round. Assume row i has posion\nPig 2 scan vertically column by column and will spot the column contains poinson after 2 round. Assume column j has posion\nThen, point will be in position markted by \'row i, column j\'.\n\nExample 2: What is the minimal number of pigs are needed to test 27 bucteks within 2 rounds?\nAnswer: 3.\nWhy?\nAssume the 27 buckets are arranged as following 3X3X3 puzzle cube:\n\n![image](https://assets.leetcode.com/users/images/237943f9-b2ae-48e8-9058-5c12d207d2b6_1605378880.9787207.png)\n\nOr mathmatically,\n[1  2  3\n4  5  6\n7  8  9]\n\n[10 11 12\n13  14 15\n16 17 18]\n\n[19  20  21\n22 23 24\n25 26 27]\n\n3 pigs can scan 3-axis one by one. After 2 rounds, the poinson will be pinpointed.\n\nCredit: https://www.cnblogs.com/grandyang/p/7664088.html\n\n**C++ Solution:**\n```\nclass Solution {\npublic:\n    int poorPigs(int buckets, int minutesToDie, int minutesToTest) {\n        // min_pig_count determined by equation: buckets =max_sub_job_load ** min_pig_count\n\t\t// max_sub_job_load  = minutesToTest / minutesToDie + 1\n        // min_pig_count = ceil(log(buckets) / log(minutesToTest / minutesToDie + 1));\n        return ceil(log(buckets) / log(minutesToTest / minutesToDie + 1));\n    }\n};\n```\n\n**Python Solution:**\n```\nclass Solution:\n    def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int:\n        return ceil(log(buckets) / log(minutesToTest / minutesToDie + 1));\n```
['C', 'Python', 'Python3']