June-21-2019

记这个题比写这个题花的时间多。不过其实这就是YSLR的YS应用。

    public int firstBadVersion(int n) {
        int l = 1, r = n;
        
        while (l <= r) {
            int m = l + (r - l) / 2;
            if (isBadVersion(m)) {
                r = m - 1;
            } else {
                l = m + 1;
            }
        }
        return l;
    }

相关文章:

  • 2021-06-04
  • 2021-12-06
  • 2021-11-23
  • 2022-12-23
  • 2021-06-07
猜你喜欢
  • 2021-06-04
  • 2021-10-02
  • 2022-02-23
  • 2021-06-04
  • 2021-05-31
  • 2022-12-23
相关资源
相似解决方案