C++ with O(m+n) complexity
bool searchMatrix(vector<vector<int>>& matrix, int target) {\n        int m = matrix.size();\n        if (m == 0) return false;\n        int n = matrix[0].size(
    bool searchMatrix(vector<vector<int>>& matrix, int target) {\n        int m = matrix.size();\n        if (m == 0) return false;\n        int n = matrix[0].size();\n\n        int i = 0, j = n - 1;\n        while (i < m && j >= 0) {\n            if (matrix[i][j] == target)\n                return true;\n            else if (matrix[i][j] > target) {\n                j--;\n            } else \n                i++;\n        }\n        return false;\n    }
[]