Python3 || easy to understand || O(n)
\nclass Solution:\n    def maximumDifference(self, nums: List[int]) -> int:\n        mn,mx=float(\'inf\'),-1\n        for i in range(len(nums)):\n            mn
```\nclass Solution:\n    def maximumDifference(self, nums: List[int]) -> int:\n        mn,mx=float(\'inf\'),-1\n        for i in range(len(nums)):\n            mn=min(mn,nums[i])\n            mx=max(mx,nums[i]-mn)\n        if mx==0: return -1\n        return mx\n```
['Python3']