// The API isBadVersion is defined for you.
// bool isBadVersion(int version);
int firstBadVersion(int n) {
int head=1,tail=n;
if(isBadVersion(head)) return 1;
while(head<=tail){
int mid=head+(tail-head)/2;
if(isBadVersion(mid)){
tail=mid-1;
}else{
head=mid+1;
}
}
return head;
}
标签:head,错误,int,isBadVersion,版本,278 From: https://www.cnblogs.com/llllmz/p/18071857