Java O(n)
\npublic int maximumDifference(int[] nums) {\n\tint result = -1, min = nums[0];\n\tfor(int i=1;i<nums.length;i++) {\n\t\tif(nums[i] != min) result = Math.max(re
```\npublic int maximumDifference(int[] nums) {\n\tint result = -1, min = nums[0];\n\tfor(int i=1;i<nums.length;i++) {\n\t\tif(nums[i] != min) result = Math.max(result, nums[i] - min);\n\t\tmin = Math.min(min, nums[i]);\n\t}\n\treturn result;\n}\n```
[]