• + 0 comments

    my solution in rust:

    fn birthday(s: &[i32], d: i32, m: i32) -> i32 {
        s.windows(m as usize)
            .filter(|&window| window.iter().sum::<i32>() == d)
            .count() as i32
    }