两个点:
1.二分法
2.越界
int firstBadVersion(int n) {
int max = 0;
int min = 0;
int cur = n;
while((max-min)!=1){
if(isBadVersion(cur)){
max = cur;
}else{
min = cur;
}
cur = min + (max-min)/2;
}
return max;
}