Backtracking  || Trying all combinations of cols
\nclass Solution {\npublic:\n    void solve(vector<vector<int>>&nums, vector<int> temp, int i, int cols, int m){\n        \n        if(i==m){\n            if(te
```\nclass Solution {\npublic:\n    void solve(vector<vector<int>>&nums, vector<int> temp, int i, int cols, int m){\n        \n        if(i==m){\n            if(temp.size() == cols)\n                nums.push_back(temp);\n            \n            return ;\n        }\n        \n        // dont take this column\n        solve(nums, temp, i+1, cols, m);\n        \n        // take this column\n        temp.push_back(i);\n        solve(nums, temp, i+1, cols, m);\n        \n        temp.pop_back();\n    \n    }\n    \n    int check(vector<vector<int>>& mat, unordered_set<int> &st, int n, int m){\n        int count = 0;\n        for(int i = 0; i<n; i++){\n            bool notValidRow = false;\n            \n            for(int j = 0; j<m; j++){\n                \n                if(mat[i][j]==1 && st.find(j)==st.end()){\n                    \n                    notValidRow = true;\n                    break;\n                    \n                }\n            }\n            \n            if(!notValidRow)\n                count++;\n        }\n        \n        return count;\n        \n    }\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        int n = mat.size();\n        int m = mat[0].size();\n        vector<vector<int>> nums;\n        vector<int> temp;\n        solve( nums, temp, 0, cols, m);\n        int res = 0;\n        \n        for(auto it: nums){\n            \n            unordered_set<int> st;\n            \n            for(auto i: it)\n                st.insert(i);\n             \n            res = max(res,check(mat, st, n, m));\n            \n        }\n        \n        return res;\n    }\n};\n```
['Backtracking', 'Recursion', 'C', 'C++']