Bit Manipulation + Brute Force
\nclass Solution {\npublic:\n    \n    int nost(int &n){\n        int a=0;\n        for(int i = 0 ; i<32; i++){\n            if(n&(1<<i))a++;\n            \n   
```\nclass Solution {\npublic:\n    \n    int nost(int &n){\n        int a=0;\n        for(int i = 0 ; i<32; i++){\n            if(n&(1<<i))a++;\n            \n        }\n        return a;\n    }\n    \n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        int n = mat[0].size();\n        int m = mat.size();\n        int ans =0;\n        for(int i =0 ; i< (1<<n); i++){\n            if(nost(i)==cols){\n                int temp =m;\n                for(int j =0 ; j< m ;j++){\n                    for(int k=0 ; k<n; k++){\n                        if(mat[j][k]){\n                            if(!(i&(1<<(n-k-1)))){\n                                temp--;\n                                break;                                \n                            }\n                        }\n                    }\n                }\n                ans= max(ans,temp);\n            }\n        }\n        return ans;\n        \n        \n    }\n};\n```
['Bit Manipulation']