Simple solution with explaination
Intuition\n Describe your first thoughts on how to solve this problem. \n\n\n\n\n\n# Code\n\nclass Solution {\n    public int largestSubmatrix(int[][] matrix) {
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n![image.png](https://assets.leetcode.com/users/images/88fef16d-4bcd-412d-aedb-93b1018d1568_1700981759.9118476.png)\n\n\n\n\n# Code\n```\nclass Solution {\n    public int largestSubmatrix(int[][] matrix) {\n        int m = matrix.length, n = matrix[0].length;\n        for (int i = 1; i < m; ++i) {\n            for (int j = 0; j < n; ++j) {\n                if (matrix[i][j] == 1) {\n                    matrix[i][j] = matrix[i - 1][j] + 1;\n                }\n            }\n        }\n        int ans = 0;\n        for (var row : matrix) {\n            Arrays.sort(row);\n            for (int j = n - 1, k = 1; j >= 0 && row[j] > 0; --j, ++k) {\n                int s = row[j] * k;\n                ans = Math.max(ans, s);\n            }\n        }\n        return ans;\n    }\n}\n```
['Java']