one-pass
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimpl Solution {\n    pub fn maximum_difference(nums: Vec<i32>) -> i32 {\n        let r = nums[1..].into_iter()\n            .fold(\n                    (0, nums[0]), |(b, x), &y| (b.max(y-x), x.min(y))).0;\n        if r == 0 {-1} else {r}\n    }\n}\n```
['Rust']