# The isBadVersion API is already defined for you.# @param version, an integer# @return an integer# def isBadVersion(version):classSolution:deffirstBadVersion(self,n):""" :type n: int :rtype: int """ left =1 right = nwhile left < right: mid = left + (right - left) //2ifisBadVersion(mid): right = midelse: left = mid +1return left