a = your_list max(a[j] - a[i] for i in range(len(a)) for j in range(i, len(a))) update max(max(a[i:]) - a[i] for i in range(len(a)))
max(arr[b] - arr[a] for b in range(len) for a in range(b+1)) 哦,对了,我是写Python 3的,如果你用Python 2,改用xrange更好。
a = your_list
update