Do binary search on the array and search the correct half. If the value at mid is larger than the left l pointer, we know the smallest element must be on the right half and vice versa.
classSolution:deffindMin(self, nums: List[int])->int: l, r =0,len(nums)-1 res = nums[0]while l <= r:if nums[l]< nums[r]:returnmin(res, nums[l]) mid =(l + r)//2 res =min(res, nums[mid])if nums[mid]>= nums[l]: l = mid +1else: r = mid -1return res