You are viewing a single comment's thread. Return to all comments →
def largestRectangle(h): n = len(h) result = 0 for i in range(1, n): j = i while h[j] < h[j-1] and j > 0: j -= 1 value = h[j] * (i - j) h[j] = h[i] result = max(result, value) for i in range(n): result = max(result, h[i] * (n-i)) return result
Seems like cookies are disabled on this browser, please enable them to open this website
Largest Rectangle
You are viewing a single comment's thread. Return to all comments →