Accepted Solution | Using Recursion | C++
\nclass Solution {\nprivate:\n    int maxi = INT_MIN;\n    int checkMax(int& m, int& n, vector<vector<int>>& mat, vector<bool>& visCols){\n        int count=0;\
```\nclass Solution {\nprivate:\n    int maxi = INT_MIN;\n    int checkMax(int& m, int& n, vector<vector<int>>& mat, vector<bool>& visCols){\n        int count=0;\n        \n        for(int i=0;i<m;i++){\n            bool flag=true;\n            for(int j=0;j<n;j++){\n                if(mat[i][j]==1 && visCols[j]==false){\n                    flag=false;\n                    break;\n                }\n            }\n            if(flag==true)\n                count++;\n        }\n        return count;\n    }\n    \n    void solve(int& m, int& n, vector<vector<int>>& mat, int col, vector<bool>& visCols, int cols){\n        //base case\n        if(cols==0){\n            maxi = max(maxi,checkMax(m,n,mat,visCols));\n            return;\n        }\n        \n        for(int j=col;j<n;j++){\n            \n            //choose this col\n            visCols[j]=true;\n            solve(m,n,mat,j+1,visCols,cols-1);\n            visCols[j]=false;\n            \n            //skip this col\n            solve(m,n,mat,j+1,visCols,cols);\n        }\n    }\npublic:\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        int m = mat.size();\n        int n = mat[0].size();\n        \n        maxi = INT_MIN;\n        vector<bool> visCols(n,false);\n        solve(m,n,mat,0,visCols,cols);\n        return maxi;\n    }\n};\n```
['Recursion', 'C']