Java short code, O(m+n)
public class Solution {\n    public boolean searchMatrix(int[][] matrix, int target) {\n        int m=matrix.length, n=matrix[0].length, i=0, j=n-1;\n        wh
    public class Solution {\n    public boolean searchMatrix(int[][] matrix, int target) {\n        int m=matrix.length, n=matrix[0].length, i=0, j=n-1;\n        while (i<m && j>=0) {\n            if (matrix[i][j]==target) return true;\n            else if (matrix[i][j]<target) i++;\n            else j--;\n        }\n        return false;\n    }\n}
[]