C++| Easy-Explanation | O(N)
Logic\n\n- We will keep track of difference at each index(res) and the minimum value(min_Ele).\n\n- We will be updating the res with max difference and min_Ele 
## Logic\n\n- We will keep track of **difference at each index**(res) and the **minimum value**(min_Ele).\n\n- We will be updating the res with max difference and min_Ele with the smallest element.\n\n- The condition that *j>i* and *nums[j]>nums[i]* is satisfied by above two points.\n\n## Implementation\n```\nint maximumDifference(vector<int> &nums)\n{\n    int res = nums[1] - nums[0];\n    // Initializing the difference\n    int min_Ele = nums[0];\n    // Minimum Elemeng at each iteration\n    for (int i = 1; i < nums.size(); i++)\n    {\n        res = max(res, nums[i] - min_Ele);\n        // Updating the difference\n        min_Ele = min(nums[i], min_Ele);\n        // Updating the minimum element\n    }\n    return res <= 0 ? -1 : res;\n}\n```\n- TC - O(N)\n**Thank You!** for reading . Do upvote  \uD83D\uDC4Dif you like the explanation if there is any scope of improvement do mention it in comments\uD83D\uDE01.
['Array', 'C', 'C++']