c++ solution using bitmasking
\nclass Solution {\npublic:\n    int maximumRows(vector<vector<int>>& mat, int cols) \n    {\n        int n=mat.size();\n        int m=mat[0].size();\n        i
```\nclass Solution {\npublic:\n    int maximumRows(vector<vector<int>>& mat, int cols) \n    {\n        int n=mat.size();\n        int m=mat[0].size();\n        int val=0;\n        for(int i=0;i<(1<<m);i++)\n        {\n            if(__builtin_popcount(i)==cols)\n            {\n                int cov=0;\n                for(int x=0;x<n;x++)\n                {\n                    int ans=true;\n                    int zero=0;\n                    int count=0;\n                    for(int y=0;y<m;y++)\n                    {\n                        if(mat[x][y]==0)\n                        {\n                            zero++;\n                        }\n                        else\n                        {\n                            if(i&(1<<y))\n                            {\n                                if(mat[x][y]==1)\n                                {\n                                    count++;\n                                }\n                            }\n                            else\n                            {\n                                ans=false;\n                            }\n                        }\n                    }\n                    if(zero==m)\n                    {\n                        cov++;\n                    }\n                    else\n                    {\n                        if(ans&&count)\n                        {\n                            cov++;\n                        }\n                    }\n                }\n                val=max(val,cov);\n            }\n        }\n        return val;\n    }\n};\n```
['Bitmask', 'C++']