✅ [c++]  ||  stack solution
\nclass Solution {\npublic:\n    int maximalRectangle(vector<vector<char>>& matrix) {\n        int row = matrix.size(); \n        if(row==0) return 0;\n        
```\nclass Solution {\npublic:\n    int maximalRectangle(vector<vector<char>>& matrix) {\n        int row = matrix.size(); \n        if(row==0) return 0;\n        int col = matrix[0].size();\n        vector<vector<int>> grid(row,vector<int> (col,0));\n        int area=0;\n        for(int i=0; i<row; ++i){\n            for(int j=0; j<col; ++j){\n                if(i==0){\n                    grid[i][j]=matrix[i][j]-\'0\';\n                }else{\n                    if(matrix[i][j]==\'0\') grid[i][j]=0;\n                    else grid[i][j] = 1+grid[i-1][j];\n                }\n            }\n            \n            vector<int> left(col), right(col);\n            stack<int> stk;\n            for(int j=0; j<col; ++j){\n                int cur = grid[i][j];\n                while(!stk.empty() && grid[i][stk.top()]>=cur) stk.pop();\n                if(stk.empty()) left[j]=-1 ;\n                else left[j]=stk.top();\n                stk.push(j);\n            }\n            \n            while(!stk.empty()) stk.pop();\n            \n            for(int j=col-1; j>=0; --j){\n                int cur = grid[i][j];\n                while(!stk.empty() && grid[i][stk.top()]>=cur) stk.pop();\n                if(stk.empty()) right[j]=col;\n                else right[j]=stk.top();\n                stk.push(j);\n            }\n            \n            for(int j=0;j<col;++j){\n                area=max(area, (grid[i][j]*(right[j]-left[j]-1)));\n            }\n        }\n        return area;\n    }\n};\n```\nPlease **UPVOTE**
['Stack', 'C', 'Monotonic Stack', 'C++']