https://leetcode-cn.com/problems/first-bad-version/



public int firstBadVersion(int n) {
int left=0,right=n,mid;
while (left<right){
mid = ((right-left)>>1)+left;
if (isBadVersion(mid)){
right = mid;
}else {
left = mid + 1;
}
}
return left;
}