Largest Rectangle in a Histogram[]

思路: 按照 1到max(histogram) 逐次查找最大面积

  1. 高为1 时…
  2. 高为2 时…

# Largest Rectangle in a Histogram
# 
def largest_histogram(histogram):
    max_area=max(histogram)
    for x in range(1,max(histogram)):
        count_1=0
        for y in histogram:
            if y>=x:
                count_1+=1
                if max_area

你可能感兴趣的:(checkio,notes)