class Solution:
    def findMin(self, nums: List[int]) -> int:
        left, right = 0, len(nums) - 1
        mid = -1

        while left < right:
            mid = left + (right - left) // 2
            if nums[mid] < nums[right]: 
                right = mid
            elif nums[mid] < nums[left]:
                left = mid
            else:
                while mid < right:
                    prev = mid
                    mid = mid + 1
                    if nums[prev] > nums[mid]:
                        return nums[mid]

        return nums[mid]