My java solution using binary search
public class Solution {\n        public boolean searchMatrix(int[][] matrix, int target) {\n            int m=matrix.length;\n            int n=matrix[0].length
    public class Solution {\n        public boolean searchMatrix(int[][] matrix, int target) {\n            int m=matrix.length;\n            int n=matrix[0].length;\n            if(m==0)\n            return false;\n            int i=m-1,j=0;\n            while(i>=0 && j<n)\n            {\n                if(matrix[i][j]==target)\n                return true;\n                else if(matrix[i][j]<target)\n                {\n                    j++;\n                }\n                else\n                {\n                    i--;\n                }\n            }\n            return false;\n        }\n    }
[]