Update bs_rotated_array.py

This commit is contained in:
marina 2023-07-31 15:42:22 -07:00 committed by GitHub
parent 5456593be9
commit d0bbfed0e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ def search(nums):
# 2. write a binary search
def bs(left, right, target):
while left < right:
while left <= right:
mid = (left + right) // 2
@ -29,7 +29,7 @@ def search(nums):
return mid
elif nums[mid] > target:
right = mid
right = mid - 1
else:
left = mid + 1