题目描述
blablabla
样例
blablabla
算法1
() $O(n^2)$
blablabla
时间复杂度分析:blablabla
代码
class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums) - 1
if n < 0:
return -1
while n > 0 and nums[0] == nums[n]:
n -= 1
if nums[n] >= nums[0]:
return nums[0]
l, r= 0, n
while l + 1 < r:
mid = l + (r - l) // 2
if nums[mid] < nums[0]:
r = mid
else:
l = mid
return nums[r]