C++ || PREFIX SUM || EASY SOLUTION
\nclass Solution {\npublic:\n    int maximumDifference(vector<int>& nums) {\n        int n=nums.size();\n        int ans=INT_MIN;\n        vector<int> right(n);
```\nclass Solution {\npublic:\n    int maximumDifference(vector<int>& nums) {\n        int n=nums.size();\n        int ans=INT_MIN;\n        vector<int> right(n);\n        right[n-1]=nums[n-1];\n        for(int i=n-2;i>=0;i--)\n            right[i]=max(right[i+1],nums[i]);\n        for(int i=0;i<n-1;i++)\n        {\n           int x=right[i+1]-nums[i];\n            if(x>0)\n            {\n                ans=max(ans,x);\n            }\n        }\n        if(ans==INT_MIN)\n            return -1;\n        return ans;\n    }\n};\n```
['C', 'Prefix Sum']