class Solution:
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return -1
n = len(nums)
i=n-1
while i and nums[i]==nums[0]:
i-=1
if nums[i]>=nums[0]:
return nums[0]
l=0
r=i
while l<r:
mid =(l+r)>>1
if nums[mid]<=nums[i]:
r=mid
else:
l=mid+1
return nums[l]