C# - Sorting by heights to get max area
csharp\npublic int LargestSubmatrix(int[][] matrix)\n{\n\tint[] heights = new int[matrix[0].Length];\n\tint result = 0;\n\n\tfor (int row = 0; row < matrix.Leng
```csharp\npublic int LargestSubmatrix(int[][] matrix)\n{\n\tint[] heights = new int[matrix[0].Length];\n\tint result = 0;\n\n\tfor (int row = 0; row < matrix.Length; row++)\n\t{\n\t\tfor (int column = 0; column < matrix[0].Length; column++)\n\t\t{\n\t\t\tif (matrix[row][column] == 0)\n\t\t\t{\n\t\t\t\theights[column] = 0;\n\t\t\t}\n\n\t\t\telse\n\t\t\t{\n\t\t\t\theights[column]++;\n\t\t\t}\n\t\t}\n\n\t\tint[] sortedHeights = heights.OrderByDescending(x => x).ToArray();\n\t\tfor (int column = 0; column < sortedHeights.Length; column++)\n\t\t{\n\t\t\tresult = Math.Max(result, sortedHeights[column] * (column + 1));\n\t\t}\n\t}\n\n\treturn result;\n}\n```
[]