2016. Maximum Difference Between Increasing Elements
On This Page
class Solution:
def maximumDifference(self, nums: List[int]) -> int:
mi = inf
res = -1
for x in nums:
if x > mi:
res = max(res, x - mi)
else:
mi = x
return res