Python 代码
class Solution(object):
def maxDiff(self, nums):
if not nums:
return 0
min_ = nums[0]
max_ = 0
for i in nums:
min_ = min(min_,i)
max_ = max(max_,i - min_)
return max_