My Java Solution
Time Complexity is probably Exponential but I can\'t say the exact figure.\nSpace Complexity: O(N - cols)\n\nclass Solution {\n    int M, N;\n    public int max
***Time Complexity is probably Exponential but I can\'t say the exact figure.***\n***Space Complexity: O(N - cols)***\n```\nclass Solution {\n    int M, N;\n    public int maximumRows(int[][] mat, int cols) {\n        M = mat.length;\n        N = mat[0].length;\n        if(cols == N) return M;\n        return findMaxRow(N - cols, mat, new ArrayList<>());\n    }\n    private int findMaxRow(int cols, int[][] mat, List<Integer> list) {\n        if(cols == 0) {\n            int rows = 0;\n            for(int i=0 ;i<M ;i++) {\n                boolean isAdded = true;\n                for(int j : list) {\n                    if(mat[i][j] == 1) {\n                        isAdded = false;\n                        break;\n                    }\n                }\n                if(isAdded) rows++;\n            }\n            return rows;\n        }\n        \n        int last = list.size() != 0 ? list.get(list.size() - 1) : -1;\n        int maxRow = -1;\n        \n        for(int i=last + 1 ;i<N ;i++) {\n            list.add(i);\n            maxRow = Math.max(maxRow, findMaxRow(cols - 1, mat, list));\n            list.remove(list.size() - 1);\n        }\n        return maxRow;\n    }\n}\n```
['Backtracking', 'Java']