public static int largestRectangleArea(int[] height) {//naive solution. O(n^2)
    	int len = height.length;
    	int max = 0;
    	int temp = 0;
    	for (int i = 0; i < len-1; ++i) {
    		for (int j = i+1; j < len; ++j) {
    			int min_height_ij = height[i];
    			for (int k = i; k <= j; ++k) {
    				if (height[k] < min_height_ij) min_height_ij = height[k];
    			}
    			temp = (j-i+1) * min_height_ij;
    			if (temp > max) max = temp;
    		}
    	}
        return max;
    }