3.二分查找算法精髓

        int left = 0, right = m * n - 1;
        int pivotIdx, pivotElement;
        while (left <= right) {
         pivotIdx = (left + right) / 2;//中间点
         pivotElement = matrix[pivotIdx / n][pivotIdx % n];//中间点在二维矩阵中位置
         if (target == pivotElement) return true;
         else {
         if (target < pivotElement) right = pivotIdx - 1;
            else left = pivotIdx + 1;
            }
         }

求数组长度

s.length

字符串长度

s.length()

原文地址:https://www.cnblogs.com/manmanchanglu/p/12489705.html