Ruby | 100% | Bit mask
Runtime: 192 ms, faster than 100.00% of Ruby online submissions\n#### Memory Usage: 211.1 MB, less than 100.00% of Ruby online submissions\nruby\ndef maximum_ro
#### Runtime: 192 ms, faster than 100.00% of Ruby online submissions\n#### Memory Usage: 211.1 MB, less than 100.00% of Ruby online submissions\n```ruby\ndef maximum_rows(mat, cols)\n  m, n, max = mat.length, mat[0].length, 0\n  ints = mat.map{ _1.reduce(0) { |s, n| s * 2 + n }}  # int form line of bits\n  [*0...n].combination(cols).map { |comb|             # comibations of columns of `cols` length \n    mask = comb.reduce(0) { |sum, n| sum + (1 << n) } # convert to bit mask (reversed order of bits doesn\'t metter)\n    ints.count { |i| mask & i == i }                  # count of mask covers i\n  }.max                                               # return max\nend\n```
['Bitmask', 'Ruby']