class Solution:
def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
left =0
right = n
if n ==1:
return 1
while left < right:
mid= (left+right) //2
if isBadVersion(mid) is False:
left =mid+1
else:
right = mid
return left
是一个二分问题的求解