Function advent_of_code_2021::day_1::count_increments[−][src]

fn count_increments(depths: &Vec<i32>) -> usize
Expand description

Iterate over a moving window of pairs, returning the count where the second number is greater that the first.

Example from puzzle specification

let input = vec![
  199, // N/A - first item
  200, // yes
  208, // yes
  210, // yes
  200, // no
  207, // yes
  240, // yes
  269, // yes
  260, // no
  263  // yes
];

assert_eq!(count_increments(&input), 7);