[Golang] No Sorting
Complexity\n- Time complexity:\nO(m*n)\n\n- Space complexity:\nO(n)\n\n# Code\n\ntype Pair struct {\n    Height int\n    Column int\n}\n\nfunc largestSubmatrix(
# Complexity\n- Time complexity:\nO(m*n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\ntype Pair struct {\n    Height int\n    Column int\n}\n\nfunc largestSubmatrix(matrix [][]int) int {\n    m, n := len(matrix), len(matrix[0])\n    prevHeights := []Pair{}\n    res := 0\n\n    for row := 0; row < m; row++ {\n        heights := []Pair{}\n        seen := make([]bool, n)\n\n        // Check prevHeights(rows) first and increment heights\n        for _, pair := range prevHeights {\n            height, col := pair.Height, pair.Column\n            if matrix[row][col] == 1 {\n                heights = append(heights, Pair{height+1, col})\n                seen[col] = true\n            }\n        }\n\n        // Start from height = 1\n        for col := 0; col < n; col++ {\n            if !seen[col] && matrix[row][col] == 1 {\n                heights = append(heights, Pair{1, col})\n            }\n        }\n\n        // Here heights will be in descending order\n        // So i+1, gives width. \n        for i := 0; i < len(heights); i++ {\n            res = max(res, heights[i].Height * (i+1))\n        }\n\n        prevHeights = heights\n    }\n\n    return res\n}\n\nfunc max(a, b int) int {\n    if a > b {\n        return a\n    }\n    return b\n}\n```
['Go']