LeetCode 278 First Bad Version
// Forward declaration of isBadVersion API. bool isBadVersion(int version); int firstBadVersion(int n) { int start=1, end=n; while(start < end) { int mid=start+(end-start)/2; if(isBadVersion(mid)) end=mid; else start=mid+1; } return start; }
LeetCode 278 First Bad Version
原文:http://www.cnblogs.com/walker-lee/p/5002341.html