Skip to content

Instantly share code, notes, and snippets.

@mym0404
Created June 6, 2022 14:45
Show Gist options
  • Save mym0404/a1e8aae7b4ba149b505b6e5cc928846b to your computer and use it in GitHub Desktop.
Save mym0404/a1e8aae7b4ba149b505b6e5cc928846b to your computer and use it in GitHub Desktop.
from bisect import bisect_left
arr = [1, 2, 3, 3, 5, 6, 6, 8, 9, 10]
left, right = 0, 9
target = 8
answer = bisect_left(arr, target, lo=left, hi=right)
print(answer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment