javascript 100.00% 72 ms
\nvar maximalRectangle = function (matrix) {\n    const n = matrix.length;\n    if (n === 0) return 0;\n    const m = matrix[0].length;\n\n    const h = new Arr
```\nvar maximalRectangle = function (matrix) {\n    const n = matrix.length;\n    if (n === 0) return 0;\n    const m = matrix[0].length;\n\n    const h = new Array(n).fill(0);\n\n    let max = 0;\n    for (let j = 0; j < m; j++) {\n        for (let i = 0; i < n; i++) {\n            if (matrix[i][j] === \'1\') h[i]++;\n            else h[i] = 0;\n        }\n        for (let i = 0; i < n; i++) {\n            let k1 = i - 1;\n            while (k1 >= 0 && h[i] <= h[k1]) k1--;\n            let k2 = i + 1;\n            while (k2 < n && h[i] <= h[k2]) k2++;\n            max = Math.max(max, h[i] * (k2 - k1 - 1));\n        }\n    }\n    return max;\n}\n```
['JavaScript']