My solution: python


  • 0
    U
    class Solution(object):
        def firstBadVersion(self, n):
            """
            :type n: int
            :rtype: int
            """
            first = 0
            last = n
            while last > first:
                mid = ( first + last )/2
                if isBadVersion(mid):
                    last = mid
                else:
                    first = mid + 1
            return first
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.