Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def firstBadVersion(self, n):
- l = 0
- r = n
- while l<r:
- m = (l + r)//2
- print(l,m,r)
- if(isBadVersion(m)):
- r = m
- if(r == l + 1):
- return m
- else:
- l = m
- if(r == l + 1):
- return l + 1
- return l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement