C
de
S
pace
Explore
Log In
Explore
Sign Up
Log In
averymueller956
22.05.2026 12:10
0
Password generator #73
Small script for learning
utils.py
def binary_search(arr, target): lo, hi = 0, len(arr) - 1 while lo <= hi: mid = (lo + hi) // 2 if arr[mid] == target: return mid elif arr[mid] < target: lo = mid + 1 else: hi = mid - 1 return -1 print(binary_search([1,3,5,7,9], 7))
Idle
Try It
Clear
Log in
to leave a comment
Are you sure you want to delete this post?
Delete
Cancel