mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-30 04:36:08 -04:00
Update bs_rotated_array.py
This commit is contained in:
parent
5456593be9
commit
d0bbfed0e5
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user