JavaScript O(n) solution (Runtime: 58 ms, faster than 98.91% submissions)
\nvar maximumDifference = function (nums) {\n    let max = 0\n    let minNum = nums[0]\n    for (let i = 1; i < nums.length; i++) {\n        let guess = nums[i]
```\nvar maximumDifference = function (nums) {\n    let max = 0\n    let minNum = nums[0]\n    for (let i = 1; i < nums.length; i++) {\n        let guess = nums[i] - minNum\n        if (guess > max) {\n            max = guess\n        }\n        if (minNum > nums[i]) {\n            minNum = nums[i]\n        }\n    }\n    return max || -1\n};\n```
['JavaScript']