nums = [4, 5, 6, 7, 0, 1, 2]
target = 10

left = 0
right = len(nums)
answer = -1

left, right = 0, len(nums) - 1

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

print(nums[left])

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: