Backtracking | Simple | C++
\nclass Solution {\npublic:\n    void func(vector<vector<int>>& mat, int cols,vector <int> v,int idx,int &ans){\n        if(cols==0){\n            int cnt=0;\n 
```\nclass Solution {\npublic:\n    void func(vector<vector<int>>& mat, int cols,vector <int> v,int idx,int &ans){\n        if(cols==0){\n            int cnt=0;\n            for(int i=0;i<mat.size();i++){\n                int f=1;\n                for(int j=0;j<mat[i].size();j++){\n                    if(mat[i][j]==1 && v[j]==0){\n                        f=0;\n                        break;\n                    }\n                }\n                if(f==1){\n                    cnt++;\n                }\n            }\n            ans=max(cnt,ans);\n            return;\n        }\n        \n        for(int i=idx;i<mat[0].size();i++){\n            v[i]=1;\n            func(mat,cols-1,v,i+1,ans);\n            v[i]=0;\n        }\n    }\n    \n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        int ans=0;\n        int n=mat[0].size();\n        vector <int> v(n,0);\n        func(mat,cols,v,0,ans);\n        return ans;\n    }\n};\n```
['Backtracking', 'C++']