Simple Intuition NO BITS - Backtracking
\nclass Solution {\n    public int maximumRows(int[][] mat, int cols) {\n        int m = mat.length;\n        int n = mat[0].length;\n        \n        int ones
```\nclass Solution {\n    public int maximumRows(int[][] mat, int cols) {\n        int m = mat.length;\n        int n = mat[0].length;\n        \n        int onesInRow[] = new int[m];\n        //counting number of ones in each row         \n        List<List<Integer>> onesInCol = new ArrayList<>();\n        \n        for(int i=1; i<=n; i++)\n            onesInCol.add(new ArrayList<Integer>());\n        \n        for(int i=0; i<m; i++){\n            for(int j=0; j<n; j++){\n                if(mat[i][j] == 1){\n                    onesInRow[i]++;\n                    onesInCol.get(j).add(i);\n                }\n            }\n        }\n        \n        if(cols >= n) return m;\n        int ans=0;\n        for(int i:onesInRow)\n            ans+= i==0 ? 1 : 0;\n        return ans+removeCols(0, m, n, cols, onesInRow, onesInCol, mat);\n    }\n    \n    private int removeCols(int curr, int m, int n, int cols, int []onesInRow, List<List<Integer>> onesInCol, int[][] mat){\n        if(cols == 0 || curr==n) return 0;\n        \n        \n        //hataaya\n        int ans=0;\n        for(Integer i : onesInCol.get(curr)){            \n            if(--onesInRow[i] == 0) ans++;\n        }\n        int h = ans + removeCols(curr+1, m, n, cols-1, onesInRow, onesInCol, mat);\n        for(Integer i : onesInCol.get(curr)){            \n            ++onesInRow[i];\n        }\n        //nahi hataaya\n        int nh = removeCols(curr+1, m, n, cols, onesInRow, onesInCol, mat);\n\t\t\n        return Math.max(h, nh);\n    }\n}\n```
[]