[Python] Monotone Increasing Stack, Similar problems attached
\nclass Solution:\n    def largestRectangleArea(self, heights: List[int]) -> int:\n        ## RC ##\n        ## APPROACH : MONOTONOUS INCREASING STACK ##\n     
```\nclass Solution:\n    def largestRectangleArea(self, heights: List[int]) -> int:\n        ## RC ##\n        ## APPROACH : MONOTONOUS INCREASING STACK ##\n        ## Similar to Leetcode: 1475. Final Prices With a Special Discount in a Shop ##\n        ## Similar to Leetcode: 907. Sum Of Subarray Minimums ##\n        ## Similar to Leetcode: 85. maximum Rectangle ##\n        ## Similar to Leetcode: 402. Remove K Digits ##\n        ## Similar to Leetcode: 456. 132 Pattern ##\n        ## Similar to Leetcode: 1063. Number Of Valid Subarrays ##\n        ## Similar to Leetcode: 739. Daily Temperatures ##\n        ## Similar to Leetcode: 1019. Next Greater Node In LinkedList ##\n        \n        ## LOGIC ##\n        ## 1. Before Solving this problem, go through Monotone stack.\n        ## 2. Using Monotone Stack we can solve 1) Next Greater Element 2) Next Smaller Element 3) Prev Greater Element 4) Prev Smaller Element\n        ## 3. Using \'NSE\' Monotone Stack concept, we can find width of rectangles, height obviously will be the minimum of those. Thus we can calculate the area\n        ## 4. As we are using NSE concept, adding 0 to the end, will make sure that stack is EMPTY at the end. ( so all the areas can be calculated while popping )\n        \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                height = heights[stack.pop()]\n                width = i - stack[-1] - 1\n                ans = max(ans, height * width)\n            stack.append(i)\n        heights.pop()\n        return ans\n```
['Python', 'Python3']