Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created March 3, 2020 14:35
Show Gist options
  • Save deque-blog/bf57b8ac155408ce76d4abdb3acb34c5 to your computer and use it in GitHub Desktop.
Save deque-blog/bf57b8ac155408ce76d4abdb3acb34c5 to your computer and use it in GitHub Desktop.
def find_guilty_commit(commits: List[CommitId]) -> Optional[CommitId]:
lo = 0
hi = len(commits) - 1
while lo <= hi:
mid = lo + (hi - lo) // 2
if is_test_failing(commits[mid]):
hi = mid - 1
else:
lo = mid + 1
return commits[lo] if lo < len(commits) else None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment