Question Name: Find Minimum in Rotated Sorted Array II
This question is essentially the same as the prevous one.
Solution to Find Minimum in Rotated Sorted Array II by LeetCode
# @param num, a list of integer
# @return an integer
def findMin(self, num):
if num < num[-1]:
# Completely sorted
elif len(num) < 5:
# The input is small enough to do a linear search.
# The length of input is greater than 2. So the division won't get
# an empty list.
# The input may be or may be not sorted.
mid = (len(num) - 1) // 2
return min(self.findMin(num[:mid]), self.findMin(num[mid:]))