C++ Dynamic programming, not so fast, but easy with explanation.
The key to the question is that, in each row, we can compute the area subtended by each column to its right. The maximum value will eventually be computed. The 
The key to the question is that, in each row, we can compute the area subtended by each column to its right. The maximum value will eventually be computed. The complexity is O(n*m*m). The dynamic programming comes from just memoizing the height of column row by row.\n```\nvector<vector<int>> memo;\nint maximalRectangle(vector<vector<char>>& matrix) \n{\n\tint n=matrix.size(),m;\n    if(n)\n        m=matrix[0].size();\t\n\tmemo.resize(n,vector<int>(m,0));\n    if(n>0)\n        for(int j=0;j<m;++j)\n            if(matrix[0][j]==\'1\')\n                memo[0][j]=1;\n   \tfor(int i=1;i<n;++i)//finding height of  each cloumn in each row.\n\t\tfor(int j=0;j<m;++j)\n\t\t\tif(matrix[i][j]==\'1\')\n\t\t\t\tmemo[i][j]=1+memo[i-1][j];\n\tint ret=0;\n\tfor(int i=0;i<n;++i)\n\t\tfor(int j=0;j<m;++j)\n\t\t{\n\t\t\tint h=memo[i][j];\n\t\t\tfor(int k=j;k<m;++k)\n\t\t\t{\n\t\t\t\th=min(h,memo[i][k]);\n\t\t\t\tret=max(ret,(k-j+1)*h);\n\t\t\t}\n\t\t}\n\treturn ret;\n}\n```
['Dynamic Programming', 'C++']