From 66248e33e20868c4cc3d6872f1550c0bf9522a94 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Mon, 6 Dec 2021 18:25:30 +0100 Subject: Let's not talk about the other solutions, 'kay? --- src/day1.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/day1.rs') diff --git a/src/day1.rs b/src/day1.rs index 3e9037a..5c4949b 100644 --- a/src/day1.rs +++ b/src/day1.rs @@ -21,6 +21,15 @@ pub fn solve_part1_iterators(input : &Vec) -> usize { input.iter().skip(1).zip(input.iter()).filter(|(new, old)| new > old).count() } +#[aoc(day1, part2, ItTookMeWayTooLongToRealizeThis)] +pub fn solve_part2_correct_solution(input : &Vec) -> usize { + input.iter().skip(3).zip(input.iter()).filter(|(new, old)| new > old).count() +} + +//-------------------------------------------------------------------------------------------- +//let's not talk about the stuff below. It's just here for reference. Because it took me way too +//long to realize that part 2 is just part 1 with a different offset... + #[aoc(day1, part2, InternalState)] pub fn solve_part2(input : &Vec) -> usize { let floating_window :u32 = input.iter().take(3).sum(); @@ -192,3 +201,5 @@ pub fn solve_part2_accumulator_infallible(input : &Vec) -> Option { } ) } + + -- cgit v1.2.3