def search(nums, target):
n = len(nums)
if n == 0:
return False
left = 0
right = n - 1
while left <=right:
mid = left + (right - left) // 2
if nums[mid] == target:
return True
if nums[mid]==nums[left]==nums[right]:
left+=1
right-=1
elif nums[left] <= nums[mid]:
if nums[left] <= target < nums[mid]:
right = mid - 1
else:
left = mid + 1
else:
print(right)
if nums[mid] < target <= nums[right]:
left = mid + 1
else:
right = mid - 1
return False
nums=[1,3,1,1,1]
target=3
result=search(nums,target)
print(result)