Skip to content

Instantly share code, notes, and snippets.

@saikpr
Created February 13, 2019 14:50
Show Gist options
  • Save saikpr/91521a3eb888ed3e3e702c914351dbde to your computer and use it in GitHub Desktop.
Save saikpr/91521a3eb888ed3e3e702c914351dbde to your computer and use it in GitHub Desktop.
def firstBadVersion(arr, target, low, high):
"""
:type n: int
:rtype: int
"""
while low!=high:
mid = (high + low)/2
if arr[mid]>=target:
high = mid
else:
low = mid +1
return int(low)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment