leetcode278-第一个错误的版本
// Forward declaration of isBadVersion API. bool isBadVersion(int version); int firstBadVersion(int n) { int high = n; int low = 1; int mid ; int midVer; while(low <= high) { mid = low + (high-low)/2; midVer = isBadVersion(mid); if (midVer == false) low = mid+1; else high = mid-1; } return low; }