codertype typing test
30
def binary_search(arr, target):
left, right = 0, len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid + 1
else:
right = mid - 1tap here to start typingclick here or press any key to focus
tab– restart test
escorctrl+shift+p– command palette