628. Maximum Product of Three Numbers Easy

@problem@discussion
#Array#Math#Sorting



1/**
2 * [628] Maximum Product of Three Numbers
3 *
4 * Given an integer array nums, find three numbers whose product is maximum and return the maximum product.
5 *  
6 * Example 1:
7 * Input: nums = [1,2,3]
8 * Output: 6
9 * Example 2:
10 * Input: nums = [1,2,3,4]
11 * Output: 24
12 * Example 3:
13 * Input: nums = [-1,-2,-3]
14 * Output: -6
15 *  
16 * Constraints:
17 * 
18 * 	3 <= nums.length <= 10^4
19 * 	-1000 <= nums[i] <= 1000
20 * 
21 */
22pub struct Solution {}
23
24// problem: https://leetcode.com/problems/maximum-product-of-three-numbers/
25// discuss: https://leetcode.com/problems/maximum-product-of-three-numbers/discuss/?currentPage=1&orderBy=most_votes&query=
26
27// submission codes start here
28
29impl Solution {
30    pub fn maximum_product(nums: Vec<i32>) -> i32 {
31        0
32    }
33}
34
35// submission codes end
36
37#[cfg(test)]
38mod tests {
39    use super::*;
40
41    #[test]
42    fn test_628() {
43    }
44}
45


Back
© 2025 bowen.ge All Rights Reserved.