@@ -0,0 +1,910 @@
+public class Solution %7B%0A    /**%0A     * @param matrix, a list of lists of integers%0A     * @param target, an integer%0A     * @return a boolean, indicate whether matrix contains target%0A     */%0A    public boolean searchMatrix(int%5B%5D%5B%5D matrix, int target) %7B%0A        // write your code here%0A        if (matrix.length == 0 %7C%7C matrix%5B0%5D.length == 0) %7B%0A            return false;%0A        %7D%0A%0A        int nrows =  matrix.length;%0A        int ncols = matrix%5B0%5D.length;%0A        int l = 0;%0A        int r = nrows * ncols - 1;%0A        int m;%0A        int i;%0A        int j;%0A%0A        while (l %3C= r) %7B%0A            m = (l + r) / 2;%0A            i = m / ncols;%0A            j = m %25 ncols ;%0A            if (matrix%5Bi%5D%5Bj%5D == target) %7B%0A                return true;%0A            %7D else if (matrix%5Bi%5D%5Bj%5D %3C target) %7B%0A                l = m + 1;%0A            %7D else %7B%0A                r = m - 1;%0A            %7D%0A        %7D%0A%0A        return false;%0A    %7D%0A%7D

Create Search a 2D Matrix for LintCode