public int maximalRectangle(char[][] matrix) {
        int res = 0;
        if(matrix == null) return res;
        int[] height = new int[matrix[0].length];
        for(int i = 0; i < height.length; ++i){
            height[i] = matrix[0][i] - '0';
        }
        res = largestRectangleArea(height);

        for(int i = 1; i < matrix.length; ++i){
            for(int j = 0; j < matrix[i].length; ++j){
                if(matrix[i][j] == '0'){
                    height[j] = 0;
                }else{
                    height[j] += matrix[i][j] - '0';
                }
            }
            res = Math.max(res, largestRectangleArea(height));
        }
        return res;
    }