Beat 100% - Easy solution with explanation similar problem - maximal-rectangle
intuition\n matrix[i][j] is sum of continous 1\'s\n sort the each row to keep largest matrix because we can swap the columns\n\nadd the continous 1\'s from top 
**intuition**\n* matrix[i][j] is sum of continous 1\'s\n* sort the each row to keep largest matrix because we can swap the columns\n\nadd the continous 1\'s from top to bottom.\nsort the each row to find the largest matrix\n\nEx:\n```\nmatrix= [[1,0,0],\n\t\t[1,0,1],\n\t\t[1,1,1]];\n```\n\nafter counting continous 1\'s, we get\n\n```\nmatrix=[[1,0,0],\n\t\t[2,0,1],\n\t\t[3,1,2]];\n```\n\n* sort each row since we can rearrange the columns \n* for each element a[i] in row, find the length of array k such that **k=i-j** where `a[i]<=a[i+1]<=a[i+2]....<=a[j]`\n* find the largest matrix by `a[i] * n-i`, n is length of array. \n\n\n in 3rd row, after sorting we get a[] = [1,2,3], n=3\n* \tfor a[0], res = a[0]*3-0 =>3\n* \tfor a[1], res = a[1]*3-1 =>4\n* \tfor a[2], res = a[2]*3-2 =>3\n\n  so, the largest matrix is 4\n\nIts similar to \nhttps://leetcode.com/problems/maximal-rectangle/\n```\nclass Solution {\n    public int largestSubmatrix(int[][] matrix) {\n\t\tfor (int i = 1; i < matrix.length; i++) {\n\t\t\tfor (int j = 0; j < matrix[i].length; j++) {\n\t\t\t\tif (matrix[i][j] != 0) {\n\t\t\t\t\tmatrix[i][j] += matrix[i - 1][j];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint res = 0;\n\t\tfor (int i = 0; i < matrix.length; i++) {\n\t\t\tArrays.sort(matrix[i]);\n\t\t\tfor (int j = 0; j < matrix[i].length; j++) {\n\t\t\t\tres = Math.max(res, matrix[i][j] * (matrix[i].length - j ));\n\t\t\t}\n\t\t}\n\t\treturn res;\n    }\n}\n```
[]