Answer:
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(H):
# write your code in Python 3.6
# return area of atmost 2 banners
# 1 banner
# maximum height * number of buildings
single_banner = max(H) * len(H)
smallest_area = single_banner
# 2 banner
for i in range(1, len(H)):
double_banner = (max(H[0:i]) * len(H[0:i])) + (max(H[i:]) * len(H[i:]))
if double_banner < smallest_area:
smallest_area = double_banner
return smallest_area