C++ solution\uff0c simple and clean code
 int maximalRectangle(vector<vector<char>>& matrix) {\n        const int row = matrix.size();\n        if (0 == row) return 0;\n        const int col = matrix[0
     int maximalRectangle(vector<vector<char>>& matrix) {\n        const int row = matrix.size();\n        if (0 == row) return 0;\n        const int col = matrix[0].size();\n        vector<vector<int>> ones(row, vector<int>(col+1, 0));\n        for (int i = 0; i < row; i++) \n         for (int j = 0; j < col; j++) {\n              if (matrix[i][j] == '1') {\n                  ones[i][j] = 1 + (i > 0 ? ones[i-1][j] : 0);\n              }\n         }\n         int i = 0, max_a = 0;\n         for (i; i < row; i++) {\n             stack<int> stk;\n             vector<int> cur = ones[i];\n             int idx = 0;\n             while (idx < cur.size()) {\n                 if (stk.empty() || cur[idx] >= cur[stk.top()]) {\n                     stk.push(idx++);\n                 } else {\n                    int h = stk.top();\n                    stk.pop();\n                    max_a = max(max_a, cur[h] *(stk.empty() ? idx : idx - stk.top() - 1));\n                 }\n             }\n         }\n         return max_a;\n    }
[]