Standard Interview point of view Stack Solution
\nclass Solution {\npublic:\n    int largestRectangleArea(vector<int>& heights) {\n        int n = heights.size();\n        if(n == 0)\n            return 0;\n 
```\nclass Solution {\npublic:\n    int largestRectangleArea(vector<int>& heights) {\n        int n = heights.size();\n        if(n == 0)\n            return 0;\n        \n        stack<int> S;\n        \n        int L[n];\n        int R[n];\n        \n        for(int i=0; i<n; i++) {\n            while(!S.empty() && heights[S.top()] >= heights[i]) \n                S.pop();\n            \n            L[i] = S.empty() ? -1 : S.top();\n            S.push(i);\n        }\n        \n        while(!S.empty()) S.pop();\n        \n        for(int i=n-1; i>=0; i--) {\n            while(!S.empty() && heights[S.top()] >= heights[i])\n                S.pop();\n            \n            R[i] = S.empty() ? n : S.top();\n            S.push(i);\n        }\n        \n        int ans = 0;\n        \n        for(int i=0; i<n; i++) {\n            ans = max(ans, (R[i]-L[i]-1) * heights[i]);\n        }\n        \n        return ans;\n    }\n};\n```
['C']