My Python Solution using binary search

  • 2
    def findMin(self, num):
            def getMin(start, end):
                if start == end:
                    return num[end]
                median = (start+end)/2
                if num[median] < num[median-1]:
                    return num[median]
                elif num[median] > num[end]:
                    return getMin(median+1, end)
                    return getMin(start, median-1)
            return getMin(0, len(num)-1)

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.