C++ | Bit Masking | Faster than 100% | O(2^n * n)
Approach\n1. Convert each row into a decimal number and store in a vector.\n2. Then traverse over range 1 << size of column, to go through all permutations havi
**Approach**\n1. Convert each row into a decimal number and store in a vector.\n2. Then traverse over range 1 << size of column, to go through all permutations having set_bits = cols. \n3. For each such permutation count number of elements in above generated vector which have set bits at same position.\n4. Store the maximum answer.\n```\nclass Solution {\npublic:\n    int maximumRows(vector<vector<int>>& mat, int cols) {\n        int m = mat.size(), n = mat[0].size();\n        vector<int> nums;\n        for(int i = 0; i < m; i++) {\n            string str;\n            for(int j = 0; j < n; j++) {\n                str += (mat[i][j] + \'0\');\n            }\n            int number = stoi(str, nullptr, 2);\n            nums.push_back(number);\n        }\n        int range = 1 << n;\n        int ans = 0;\n        for(int i = 0; i < range; i++) {\n            int count = 0;\n            if(__builtin_popcount(i) == cols) {\n                for(auto it : nums) {\n                    if((it | i) == i)\n                        count++;\n                }\n            }\n            ans = max(ans, count);\n        }\n        return ans;\n    }\n};\n```
['C', 'Bitmask']