🤯 Simplest Python Solution | Brute Force | Combinations
Upvote if you like\n\n\nclass Solution:\n    def maximumRows(self, mat: List[List[int]], cols: int) -> int:\n        columns = [i for i in range(len(mat[0]))]\n
Upvote if you like\n\n```\nclass Solution:\n    def maximumRows(self, mat: List[List[int]], cols: int) -> int:\n        columns = [i for i in range(len(mat[0]))]\n\t\t# All combinations of columns to select\n        combos = combinations(columns, cols)\n        ans = 0\n        \n\t\t# For every combo try to count number of valid rows\n        for combo in combos:\n            combo = set(combo)\n            selectedRows = 0\n            \n            for r in range(len(mat)):\n                for c in range(len(mat[0])):\n                    if mat[r][c] == 1 and c not in combo:\n                        break\n                else:\n\t\t\t\t# select a row only if it has 1s in the selected columns(combo) i.e. if loop never breaks\n                    selectedRows += 1\n            \n            ans = max(ans, selectedRows)\n        \n        return ans\n```
['Python']