C++ Solution
cpp\nclass Solution {\npublic:\n    int maximumRows(vector<vector<int>> &mat, int cols) {\n        int m = mat.size(), n = mat[0].size();\n        int perm = po
```cpp\nclass Solution {\npublic:\n    int maximumRows(vector<vector<int>> &mat, int cols) {\n        int m = mat.size(), n = mat[0].size();\n        int perm = pow(2, n) - 1;\n        vector<vector<int>> grid(perm + 1, vector<int>(n, 0));\n        for (int i = 0; i <= perm; i++) {\n            for (int j = 0; j < n; j++) {\n                if ((i & (1 << j)) >= 1) {\n                    grid[i][j] = 1;\n                }\n            }\n        }\n        int mx = 0;\n        for (int i = 0; i <= perm; i++) {\n            int cnt = 0, temp = 0;\n            unordered_set<int> st;\n            for (int j = 0; j < n; j++) {\n                if (grid[i][j] == 1) {\n                    st.insert(j);\n                    cnt++;\n                }\n            }\n            if (cnt == cols) {\n                for (int i = 0; i < m; i++) {\n                    bool flag = false;\n                    for (int j = 0; j < n; j++) {\n                        if (st.count(j) == 0) {\n                            if (mat[i][j] == 1) {\n                                flag = true;\n                            }\n                        }\n                    }\n                    if (!flag) temp++;\n                }\n            }\n            mx = max(mx, temp);\n        }\n        return mx;\n    }\n};\n```
['C', 'C++']