@@ -0,0 +1,589 @@
+/* The isBadVersion API is defined in the parent class VersionControl.%0A      boolean isBadVersion(int version); */%0A%0Apublic class Solution extends VersionControl %7B%0A    public int firstBadVersion(int n) %7B%0A        if(n %3C= 0 %7C%7C isBadVersion(n) == false)%7B%0A            return 0;%0A        %7D%0A        if(isBadVersion(1))%7B%0A            return 1;%0A        %7D%0A        int i, j;%0A        for(i = 1, j = n; i %3C j-1;)%7B%0A            int tmp = i + (j-i) / 2;%0A            if(isBadVersion(tmp))%7B%0A                j = tmp;%0A            %7Delse%7B%0A                i = tmp;%0A            %7D%0A        %7D%0A        return j;%0A    %7D%0A%7D

Q278 First Bad Version