import math
import collections
class Solution(object):
def maxDiff(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
res=0
nums=collections.deque(nums)
# print(nums)
n=len(nums)
for x in range(n-1):
now=nums.popleft()
xxx=list(nums)
res=max(res,max(xxx)-now)
# print(res)
return res