Python3 solution | O(n) faster than 99%
\'\'\'\n\nclass Solution:\n    def maximumDifference(self, nums: List[int]) -> int:\n        my_max = -1\n        min_here = math.inf # the minimum element unti
\'\'\'\n```\nclass Solution:\n    def maximumDifference(self, nums: List[int]) -> int:\n        my_max = -1\n        min_here = math.inf # the minimum element until i-th position\n        for i in range(len(nums)):\n            if min_here > nums[i]:\n                min_here = nums[i]\n            dif = nums[i] - min_here \n            if my_max < dif and dif != 0: # the difference mustn\'t be 0 because nums[i] < nums[j] so they can\'t be equals\n                my_max = dif\n        return my_max\n```\nIf you like it, please upvote!^^\n\'\'\'
['Python', 'Python3']