C++ Solution
class Solution {\npublic:\n    int maximalRectangle(vector<vector<char>>& matrix) {\n        vector<int> dp (matrix[0].size(), 0);\n        int res = 0;\n      
```class Solution {\npublic:\n    int maximalRectangle(vector<vector<char>>& matrix) {\n        vector<int> dp (matrix[0].size(), 0);\n        int res = 0;\n        \n        for (int i = 0; i < matrix.size(); i++) {\n            for (int j = 0; j < matrix[0].size(); j++) {\n                if (matrix[i][j] == \'1\') {\n                    dp[j] ++;\n                    int row_len = dp[j];\n                    int k = j;\n                    while (k >= 0) {\n                        row_len = min(row_len, dp[k]);\n                        res = max(res, row_len * (j - k + 1));\n                        k--;\n                    }\n                } else {\n                    dp[j] = 0;\n                }\n            }\n        } \n        return res;\n    }\n};\n```
['Dynamic Programming', 'C']