// tag::solve_with_itertools[]
/// Return the product on the combination of `n` numbers in list that sum up to 2020.
///
/// The solution uses itertools::combinations to iterate through the combinations.
///
/// # Examples
///
/// ```
/// let list: Vec<i32> = vec![1721, 979, 366, 299, 675, 1456];
/// let prod2 = mr_kaffee_2020_01::solve_with_itertools(&list, 2);
/// assert_eq!(prod2, 514_579);
/// let prod3 = mr_kaffee_2020_01::solve_with_itertools(&list, 3);
/// assert_eq!(prod3, 241_861_950);
/// ```
:solve_with_itertools[]
Return the product on the combination of `n` numbers in list that sum up to 2020.

The solution uses itertools::combinations to iterate through the combinations.
: solve_with_itertools [] Return the product on the combination of ` n ` numbers in list that sum up to 2020 . The solution uses itertools :: combinations to iterate through the combinations .
pub fn solve_with_itertools(list: &[i32], n: usize) -> i32 {
    list.iter().combinations(n)
        .find(|v| v.iter().map(|a| *a).sum::<i32>() == 2020)
        .expect("Nothing found").into_iter()
        .product()
}
pub fn solve_with_itertools ( list : & [ i32 ] , n : usize ) -> i32 { list . iter ( ) . combinations ( n ) . find ( | v | v . iter ( ) . map ( | a | * a ) . sum :: < i32 > ( ) == 2020 ) . expect ( " " ) . into_iter ( ) . product ( ) }
tag::solve_with_itertools[]
Return the product on the combination of `n` numbers in list that sum up to 2020.
tag :: solve_with_itertools [] Return the product on the combination of ` n ` numbers in list that sum up to 2020 .
list
&[i32]
n
usize
examples
None