Python | DP
\nclass Solution(object):\n    def maximalRectangle(self, matrix):\n        if len(matrix) == 0: return 0\n        matrix, rows, cols=[map(int, i) for i in matr
```\nclass Solution(object):\n    def maximalRectangle(self, matrix):\n        if len(matrix) == 0: return 0\n        matrix, rows, cols=[map(int, i) for i in matrix], len(matrix), len(matrix[0])\n        max_area, dp = float("-inf"), [[0 for __ in range(cols+1)] for _ in range(rows+1)]\n        for i in range(0, rows):\n            for j in range(cols):\n                dp[i][j]=matrix[i][j] if i==0 else matrix[i][j]+dp[i-matrix[i][j]][j]\n        for i in range(rows):\n            for j in range(cols):\n                current_height = dp[i][j]\n                for k in range(j, cols):\n                    current_height = min(current_height, dp[i][k])\n                    max_area = max(max_area, current_height * (k-j+1))\n        return max_area\n```
['Dynamic Programming', 'Python']