Python binary search simple solution


  • 0
    A
    ```def firstBadVersion(self, n):
        """
        :type n: int
        :rtype: int
        """
        l, r = 1, n
        
        while l < r:
            m = (l + r) / 2
            if isBadVersion(m):
                r = m
            else:
                l = m + 1
        
        return l
    

Log in to reply
 

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