AC Maximal Rectangle by an O(n^2) method