<<BEAT 100% SOLUTIONS>>
PLEASE UPVOTE MECode
# PLEASE UPVOTE ME
# Code
```cpp []
class Solution {
public:
    int maximumDifference(vector<int>& nums) {
        int m=nums[0],ans=-1;
        for(int i=1;i<nums.size();i++){
            if(nums[i]>m) ans=max(ans,(nums[i]-m));
            else m=nums[i];}
        return ans;
    }
};
```
['C++']