#NEWLINE# def firstBadVersion( self , n ) : #NEWLINE# #INDENT# '\n        :param n: An integers.\n        :return: An integer which is the first bad version.\n        ' #NEWLINE# l = 1 #NEWLINE# h = ( n + 1 ) #NEWLINE# while ( l < h ) : #NEWLINE# #INDENT# m = ( ( l + h ) / 2 ) #NEWLINE# if ( not isBadVersion ( m ) ) : #NEWLINE# #INDENT# l = ( m + 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# h = m #NEWLINE# #UNINDENT# #UNINDENT# return l