题目描述
blablabla
样例
blablabla
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
python 代码
class Solution(object):
def maxDiff(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 0
minv = nums[0]
res = 0
for i in range(len(nums)):
minv = min(minv, nums[i])
maxv = nums[i] - minv
res = max(res, maxv)
return res