[C++] Clear understanding of Best time to buy and sell stocks
\nclass Solution {\npublic:\n    int maximumDifference(vector<int>& nums) {\n        int ans = 0;\n        int prev = nums[0];\n        for(int i=1;i<nums.size(
```\nclass Solution {\npublic:\n    int maximumDifference(vector<int>& nums) {\n        int ans = 0;\n        int prev = nums[0];\n        for(int i=1;i<nums.size();i++){\n            prev = min(prev,nums[i]);\n            ans = max(ans,nums[i] - prev);\n        }\n        return ans==0?-1:ans;\n    }\n};\n```\nThe problem statement is a classified explanation of Best Time Buy and Sell Stock.
['C']