def solution(A):
max_num = 0
for i, p in enumerate(A):
for q in A[i+1:]:
max_num = max(max_num, q - p)
return max_num
def solution(A):
value = 0
if A == []: return 0
min_num = A[0]
for num in A[1:]:
min_num = min(min_num, num)
value = max(value, num - min_num)
return value