C++| Backtracking | Very Easy Code
Please Upvote :)\n\n\nclass Solution {\npublic:\n    int res=0;\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        unordered_map<int,int> m;\n 
Please Upvote :)\n\n```\nclass Solution {\npublic:\n    int res=0;\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        unordered_map<int,int> m;\n        fun(mat,m,cols,0);\n        return res;\n    }\n    void fun(vector<vector<int>>& mat,unordered_map<int,int>& m,int cols,int i)\n    {\n        if(cols==0)\n        {\n            int c=0;\n            for(int p=0;p<mat.size();p++)\n            {\n                int f=1;\n                for(int q=0;q<mat[p].size();q++)\n                {\n    // if for a row the element at col i is 1 and this column was not choosen then break\n                    if(mat[p][q] && !m[q])\n                    {\n                        f=0;\n                        break;\n                    }\n                }\n                c+=f;\n            }\n            res=max(res,c);\n            return;\n        }\n        if(i>=mat[0].size())\n            return;\n        \n        // choose the column i or don\'t choose the column i\n        fun(mat,m,cols,i+1);\n        m[i]=1;\n        fun(mat,m,cols-1,i+1);\n        m[i]=0;\n    }\n};\n```
['Backtracking', 'Recursion', 'C', 'C++']