Easy C++ Solution | DP + Stack
\nclass Solution {\npublic:\n    int maxarea(vector<int> &v){\n        stack<int> s;\n        int ans=0;\n        for(int i=0; i<=v.size(); i++){\n            w
```\nclass Solution {\npublic:\n    int maxarea(vector<int> &v){\n        stack<int> s;\n        int ans=0;\n        for(int i=0; i<=v.size(); i++){\n            while(!s.empty() && (i==v.size() || v[s.top()]>v[i])){\n                int cur=s.top();\n                s.pop();\n                int width = s.empty()? i:i-s.top()-1;\n                ans = max(ans, width*v[cur]);\n            }\n            s.push(i);\n        }\n        \n        return ans;\n    }\n    \n    int maximalRectangle(vector<vector<char>>& matrix) {\n        int m = matrix.size(), n = matrix[0].size();\n        vector<int> curr(n, 0);\n        \n        int ans=0;\n        for(int i=0; i<m; i++){\n            for(int j=0; j<n; j++){\n                if(matrix[i][j]==\'1\')     curr[j]++;\n                else    curr[j]=0;\n            }\n            int area = maxarea(curr);\n            ans=max(ans, area);\n        }\n        \n        return ans;\n    }\n};\n```
['Stack', 'C', 'C++']