[Python] Similar to Leetcode 84. Explained.
\nclass Solution:\n    def maximalRectangle(self, matrix: List[List[str]]) -> int:\n        \n        ## RC ##\n        ## APPROACH : DP ##\n        ## SIMILAR 
```\nclass Solution:\n    def maximalRectangle(self, matrix: List[List[str]]) -> int:\n        \n        ## RC ##\n        ## APPROACH : DP ##\n        ## SIMILAR TO LEETCODE 84. LARGEST RECTANGLE IN A HISTOGRAM ##\n        \n        #   1. we will create heights matrix, just like below (to imagine line histogram)\n        #   2. on each heights matrix row, we find the maxArea\n        #   3. return maxArea\n        #   Ex :\n        # [\n        #   ["1","0","1","0","0"],\n        #   ["1","0","1","1","1"],\n        #   ["1","1","1","1","1"],\n        #   ["1","0","0","1","0"]\n        # ]\n        # [\n        #   ["1","0","1","0","0"],\n        #   ["2","0","2","1","1"],\n        #   ["3","1","3","2","2"],\n        #   ["4","0","0","3","0"]\n        # ]\n        \n        if(not matrix) : return 0\n        \n        for i in range(0, len(matrix)):\n            for j in range(len(matrix[0])):\n                if( matrix[i][j] == \'1\' ):\n                    matrix[i][j] = int(matrix[i][j]) + int(matrix[i-1][j] if(i>0) else 0 )\n                else:\n                    matrix[i][j] = 0\n        \n        def findLargestArea(heights):\n            if(not heights): return 0\n            heights.append(0)\n            stack = [-1]\n            ans = 0\n            for i in range(len(heights)):\n                while( heights[i] < heights[stack[-1]] ):\n                    h = heights[stack.pop()]\n                    w = i - stack[-1] - 1\n                    ans = max( ans, h*w )\n                stack.append(i)\n            return ans\n            \n        maxArea = 0\n        for row in matrix:\n            maxArea = max( maxArea, findLargestArea(row) )\n        return maxArea        \n```
['Python', 'Python3']