Rust O(N) solution
Sorting is unnecessary in such a task. \nWe only need to keep track of the 2 maximum values while traversing the vector.\n\nimpl Solution {\n    pub fn max_prod
Sorting is unnecessary in such a task. \nWe only need to keep track of the 2 maximum values while traversing the vector.\n```\nimpl Solution {\n    pub fn max_product(nums: Vec<i32>) -> i32 {\n        let (mut max1, mut max2) = (0, 0);\n        nums.iter().for_each(|&n| {\n            if n > max2 {\n                max1 = std::mem::replace(&mut max2, n);\n            } else if n > max1 {\n                max1 = n;\n            }\n        });\n        (max1 - 1) * (max2 - 1)\n    }\n}\n```
['Rust']