Sweet
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```Java []\nclass Solution {\n    public int maximumDifference(int[] nums) {\n        int diff = Integer.MIN_VALUE, num = nums[0];\n        for(int i = 1; i < nums.length; i++) {\n            if (nums[i] > num) {\n                diff = Math.max(diff, nums[i] - num);\n            }\n\n            num = Math.min(num, nums[i]);\n        }\n        return diff == Integer.MIN_VALUE ? -1 : diff;\n    }\n}\n```
['Java']