求数组所有区间最大值减去最小值之差的和(贝壳笔试题)
思路1:
暴力O(N^3),
def jicha(list1,n):
sum1=0
temp_dic={}
for i in range(n):
for j in range(n):
if(i<j):
sij = str(i) + str(j)
if(sij not in temp_dic):
temp_dic[sij]=(max(list1[i:j+1])-min(list1[i:j+1]))
for i