C++ Brute force using recursion backtracking
\nclass Solution {\npublic:\n    int maxi = 0;\n    vector<int>v;\n    \n    void count(vector<vector<int>>&mat){\n        int c = 0;\n        for(int i = 0;i<m
```\nclass Solution {\npublic:\n    int maxi = 0;\n    vector<int>v;\n    \n    void count(vector<vector<int>>&mat){\n        int c = 0;\n        for(int i = 0;i<mat.size();i++){\n            int t = 0;\n            int co= 0 ;\n            for(int j = 0;j<mat[i].size();j++){\n                if(mat[i][j] == 1)t++;\n                if(mat[i][j]==1 && v[j] == 1)co++;\n            }\n            if(t == co)c++;\n        }\n        \n        maxi = max(maxi,c);\n        return;\n    }\n    \n    void dfs(vector<vector<int>>&mat,int c,int cols){\n        if(cols == 0){\n            count(mat);\n            return;\n        }\n        if(c >= mat[0].size())return ;\n        \n        v[c] = 1;\n        \n        dfs(mat,c+1,cols-1);\n        v[c]=0;\n        dfs(mat,c+1,cols);\n        return;\n    }\n    \n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        \n        if(cols == mat[0].size())return mat.size();\n        v = vector<int>(mat[0].size(),0);\n        dfs(mat,0,cols);\n        \n        return maxi;\n    }\n};\n```
['Backtracking', 'Recursion', 'C']