java:
public class Solution extends VersionControl { public int firstBadVersion(int n) { int l = 1, r = n; while(l < r){ int m = l + (r - l ) / 2; if(isBadVersion(m)){ r = m; }else{ l = m + 1; } } return l; } }
欢迎分享,转载请注明来源:内存溢出
java:
public class Solution extends VersionControl { public int firstBadVersion(int n) { int l = 1, r = n; while(l < r){ int m = l + (r - l ) / 2; if(isBadVersion(m)){ r = m; }else{ l = m + 1; } } return l; } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)