2 C++ solutions || Binary search approach || O(m+n) and O(mlogn) time complexity
Code\n\n// Solution 1 - O(m+n) TC\nclass Solution {\npublic:\n    bool searchMatrix(vector<vector<int>>& matrix, int target) {\n        int m = matrix.size(), n
# Code\n```\n// Solution 1 - O(m+n) TC\nclass Solution {\npublic:\n    bool searchMatrix(vector<vector<int>>& matrix, int target) {\n        int m = matrix.size(), n = matrix[0].size(), r = 0, c = n - 1;\n        while (r < m && c >= 0){\n            if (matrix[r][c] == target)\n                return true;\n            // matrix[r][c] > target ? c-- : r++;\n            else if(matrix[r][c] > target)\n                c--;\n            else\n                r++;\n        }\n        return false;\n    }\n};\n\n// Solution 2 - O(mlogn) TC\nbool searchMatrix(vector<vector<int>>& matrix, int target) {\n    if (matrix.size()==0) \n        return false;\n    for(int i=0; i<matrix.size(); i++){\n        if( searchVector(matrix[i], target) ) \n            return true;\n    }\n    return false;\n }\n\nbool searchVector(vector<int>& v, int target){\n    int left = 0, right = v.size() - 1;\n\n    while (left <= right) {\n\tint mid = left + (right - left) / 2;\n\tif (v[mid] == target)\n\t\treturn true;\n\tif (v[mid] < target)\n\t\tleft = mid + 1;\n\telse\n\t\tright = mid - 1;\n    }\n\n    return false;\n }\n```
['Array', 'Binary Search', 'Matrix', 'C++']