public int maxRectangle(int j, int[][] ones) {
		Stack<Integer> stack = new Stack<Integer>();
		int max = 0, i = 0;
		
		while(i <= ones.length) {
			if(stack.isEmpty() || (i < ones.length && ones[i][j] >= ones[stack.peek()][j]))
				stack.add(i++);
			else {
				int temp = ones[stack.pop()][j];
				temp *= (stack.isEmpty() ? i : (i - 1 - stack.peek()));
				if(temp > max) max = temp;
			}
		}
		
		return max;
	}