C++ Simple and Short Solution
\nclass Solution {\npublic:\n    int maximumDifference(vector<int>& nums) {\n        int mn = nums[0], res = 0;\n        for (int i = 1; i < nums.size(); i++) {
```\nclass Solution {\npublic:\n    int maximumDifference(vector<int>& nums) {\n        int mn = nums[0], res = 0;\n        for (int i = 1; i < nums.size(); i++) {\n            res = max(res, nums[i] - mn);\n            mn = min(mn, nums[i]);\n        }\n        return res == 0 ? -1 : res;\n    }\n};\n```\n**Like it? please upvote!**
['C']