Brute - Backtracking [C++]
\nclass Solution {\npublic:\n    int ans = 0;\n    \n    int countRow(vector<int>&temp,vector<vector<int>>&mat)\n    {\n        int cnt = 0;\n        unordered_
```\nclass Solution {\npublic:\n    int ans = 0;\n    \n    int countRow(vector<int>&temp,vector<vector<int>>&mat)\n    {\n        int cnt = 0;\n        unordered_map<int,int>mpp;\n        for(auto x:temp)mpp[x]++;\n        \n        for(auto row : mat)\n        {\n            bool flag = true;\n            for(int i=0 ; i<row.size() ; i++)\n            {\n                if(row[i]==1)\n                {\n                    if(mpp.find(i)==mpp.end())\n                    {\n                        flag = false;\n                        break;\n                    }\n                }\n            }\n            if(flag == true)\n            {\n                cnt++;\n            }\n        }\n        return cnt;\n    }\n    \n    void solve(int col , vector<int>&temp ,int cols , vector<vector<int>>&mat )\n    {\n        if(col>=mat[0].size())\n        {\n            if(cols==0)\n            {\n                ans = max(ans , countRow(temp,mat));\n            }\n            return ;\n        }\n        \n        // take that column \n        temp.push_back(col);\n        solve(col+1,temp,cols-1,mat);\n        temp.pop_back();\n        \n        // don\'t take\n        solve(col+1,temp,cols,mat);\n        \n        \n    }\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        \n        vector<int>temp;\n        solve(0,temp,cols,mat);\n        return ans;\n        \n    }\n};\n```
['Backtracking', 'C']