My Java Solution with small explanation 1) Count the 1's in column 2) Sort the rows and count
\nclass Solution {\n    public int largestSubmatrix(int[][] matrix) {\n        // count number of 1 in each column and update it\n        int row = matrix.lengt
```\nclass Solution {\n    public int largestSubmatrix(int[][] matrix) {\n        // count number of 1 in each column and update it\n        int row = matrix.length;\n        int col = matrix[0].length;\n        int count = 0;\n        for (int i=1; i<row; i++) {\n            for (int j=0; j<col; j++) {\n                if (matrix[i][j] == 1)\n                    matrix[i][j] = matrix[i-1][j] + 1;\n            }\n        }\n        /*\n        0 0 1                      0 0 1\n        1 1 1     -> changes to -> 1 1 2\n        1 0 1                      2 1 3\n        */\n        for (int i=0; i<row; i++) {\n            // sort it\n            Arrays.sort(matrix[i]);\n            for (int j=1; j<=col; j++) {\n                count = Math.max(count, j * matrix[i][col - j]);\n            }\n        }\n        /*\n        0 0 1                  0 0 1\n        1 1 2   -> Sorting ->  1 1 2\n        2 1 3                  1 2 3\n        \n        */\n        return count;\n    }\n}\n```
['Sorting', 'Matrix', 'Java']