advent_of_code_2024::day_2

Function first_bad_level_pair

source
fn first_bad_level_pair(report: &Vec<u32>) -> Option<usize>
Expand description

Find the first pair in the report that either:

  • Is too large a jump in levels
  • Is not in the same direction as previous pairs

Returns None if the report is safe, or Some(idx) - the first pair that makes the report unsafe.