Java Simple Solution || 100% O(n)
\nclass Solution {\n    public int maximumDifference(int[] nums) {\n        int min=nums[0];\n        int ans=-1;\n        for(int i:nums){\n            if(i<mi
```\nclass Solution {\n    public int maximumDifference(int[] nums) {\n        int min=nums[0];\n        int ans=-1;\n        for(int i:nums){\n            if(i<min)\n                min=i;\n            if(i>min)\n                ans=Math.max(ans,i-min);\n        }\n        return ans;\n    }\n}\n```\n\n**Please UpVote!!**
['Java']