Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Solutions for "Largest Rectangle in a Histogram" solution in Clear category for Largest Rectangle in a Histogram by IvanowDenis
def largest_histogram(histogram):
l_h = len(histogram) # len histogram
res = l_h
for i in range(2, max(histogram) + 1):
floor = 0
for j in range(l_h):
if histogram[j] >= i:
floor += 1
res = max(res, floor * i)
else:
floor = 0
return res
Nov. 13, 2016