Search a 2D Matrix II C++ easy implementation
class Solution {\npublic:\n    bool searchMatrix(vector>& matrix, int target) {\n        \n       long int n=matrix[0].size();\n      bool f=0;\n            for
class Solution {\npublic:\n    bool searchMatrix(vector<vector<int>>& matrix, int target) {\n        \n       long int n=matrix[0].size();\n      bool f=0;\n            for(long int i=0,j=n-1;j>=0 && i<matrix.size();)\n            {\n                if(matrix[i][j]==target)\n                {\n                    f=1;\n                    break;\n                }\n                else if(matrix[i][j]>target)j--;\n                else i++;\n            }\n        \n       if(f)return true;\n        else return false;\n    }\n};
[]