Fast Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int maximumRows(vector<vector<int>>& mat, int numSelect) {\n        int n = mat.size() , m = mat[0].size();\n        vector<int> v; // bitmask of all the rows\n        for(int i = 0 ; i < n ; i++){\n            int curr = 0;\n            for(int j = 0 ; j < m ; j++){\n                if(mat[i][j]){\n                    curr += (1<<j);\n                }\n            }\n            v.push_back(curr);\n        }\n\n        int ans = 0;\n        for(int i = 0 ; i < (1<<m) ; i++){\n            if( __builtin_popcount(i) != numSelect) continue;\n            int tmp = 0;\n            for(auto it : v) if((it&i) == it) tmp++;\n            ans = max(ans , tmp);\n        }\n        return ans;\n        \n    }\n};\n```
['C++']