O(n^2) dp java solution
public int maximalRectangle(char[][] matrix) {\n            if (matrix.length == 0) return 0;\n            int m = matrix.length;\n            int n = matrix[0]
    public int maximalRectangle(char[][] matrix) {\n            if (matrix.length == 0) return 0;\n            int m = matrix.length;\n            int n = matrix[0].length;\n            int[] left = new int[n]; // left boundary of histogram columns.\n            int[] right = new int[n]; // right boundary of histogram columns.\n            int[] height = new int[n]; // height of histogram columns.\n            Arrays.fill(right, n);\n            int area = 0;\n            for (int i = 0; i < m; i++) {\n                int l = 0, r = n;\n                for (int j = 0; j < n; j++) {\n                    if (matrix[i][j] == '1') {\n                        height[j]++;\n                        left[j] = Math.max(l, left[j]);\n                    }\n                    else {\n                        l = j + 1;\n                        height[j] = 0;\n                        left[j] = 0;\n                        right[j] = n;\n                    }\n                }\n                for (int j = n - 1; j >= 0; j--) {\n                    if (matrix[i][j] == '1') {\n                        right[j] = Math.min(r, right[j]);\n                        area = Math.max(area, height[j] * (right[j] - left[j]));\n                    }\n                    else {\n                        r = j;\n                    }\n                }\n            }\n            return area;\n        }
['Dynamic Programming', 'Java']