Binary Search
1
2
3
4
5
6
7
8
9
10
def binary_search(nums, target)->int:
while low <= high:
if target at mid:
return mid
if nums[mid] < target:
low = mid + 1
else:
high = mid - 1
return -1