class Solution(object):
    def findMin(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        left, right = 0, len(nums) - 1
        while left < right:
            mid = (left + right) // 2
            
            if nums[mid] > nums[right]: #Сֵ϶ڡmid + 1, right
                left = mid + 1
            elif nums[mid] < nums[right]: #Сֵ϶ڡleft, mid
                right = mid
            elif nums[mid] == nums[right]: #޷ȷСֵ
                
                flag = False
                for j in range(right - 1, mid, -1):#Ҳңǲбnums[mid]С
                    if nums[mid] > nums[j]:
                        flag = True #ȷʵڸСnums[j]
                        break
                        
                if flag: #ȷСֵ϶ڡmid + 1, j
                    left = mid + 1
                    right = j
                else: #mid rightе, Сֵ϶ڡleft, mid
                    right = mid
                    
        return nums[left]
                    