Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Largest Rectangle in a Histogram by Thenbacker
def largest_histogram(histogram):
horizontal = min(histogram)*len(histogram)
vertical = 0
for i, n in enumerate(histogram):
new_value=0
try:
if n == min(histogram):
pass
elif histogram[i+1] == min(histogram):
pass
else:
new_value+= n+min(histogram[i+1], n)
if new_value > vertical:
vertical=new_value
except IndexError:
pass
return max(horizontal, vertical)
Oct. 25, 2016