// Slide a size-3 window over the numbers and sum them, e.g. [1,2,3,4,5,6] -> [6,9,12,15]
Slide a size-3 window over the numbers and sum them, e.g.
Slide a size - 3 window over the numbers and sum them e . g .
fn group_to_sums_of_3(numbers: Vec<i32>) -> Vec<i32> {
    let mut prev_2 = numbers[0];
    let mut prev_1 = numbers[1];
    let mut sums = Vec::new();
    for number in numbers.into_iter().skip(2) {
        sums.push(prev_2 + prev_1 + number);
        prev_2 = prev_1;
        prev_1 = number;
    }
    sums
}
fn group_to_sums_of_3 ( numbers : Vec < i32 > ) -> Vec < i32 > { let mut prev_2 = numbers [ 0 ] ; let mut prev_1 = numbers [ 1 ] ; let mut sums = Vec :: new ( ) ; for number in numbers . into_iter ( ) . skip ( 2 ) { sums . push ( prev_2 + prev_1 + number ) ; prev_2 = prev_1 ; prev_1 = number ; } sums }
Slide a size-3 window over the numbers and sum them, e.g.
Slide a size - 3 window over the numbers and sum them e . g .
numbers
Vec<i32>