My binary-search solution in Python with disscussing
class Solution:\n        # @param num, a list of integer\n        # @return an integer\n        def findMin(self, num):\n            first, last = 0, len(num) -
    class Solution:\n        # @param num, a list of integer\n        # @return an integer\n        def findMin(self, num):\n            first, last = 0, len(num) - 1\n            while first < last:\n                midpoint = (first + last) // 2\n                if num[midpoint] > num[last]:\n                    first = midpoint + 1\n                else:\n                    last = midpoint\n            return num[first]\n\nThis solution has a time complexity of O(log(n)) and takes about 50 ms to run.\nIn python, things are little bit different from the ones in C++ or Java. I am told that each python statement will be translated into one or several c function invocations. So less statements almost always means higher performance. I tried the one line solution "return min(num)" in this subject. It is really a system cheating and has a complexity of O(n). But it yields the identical running time as the binary-search solution. I am not sure about the test inputs. However I think we should have some large ones to make the difference (O(n) VS O(log(n))) visible. I guess we need some inputs which have 100 k or even more numbers.
['Binary Tree', 'Python']