Java Solution
\n\n# Code\n\nclass Solution {\n    public int maximumDifference(int[] nums) {\n\n        int min = nums[0],maxDifference=-1;\n        for(int i=1;i<nums.length
\n\n# Code\n```\nclass Solution {\n    public int maximumDifference(int[] nums) {\n\n        int min = nums[0],maxDifference=-1;\n        for(int i=1;i<nums.length;i++){\n            if(nums[i] <= min)\n                min = nums[i];\n            else\n                maxDifference = Math.max(maxDifference, nums[i]-min);\n        }\n        return maxDifference;\n    }\n}\n```
['Java']