aoc2021

Advent of Code 2021 solutions in Perl.
git clone git://git.samirparikh.com/aoc2021
Log | Files | Refs | README

commit 29def93e15cbb7f699974fe974a4fbd5e6614d9f
parent ada88afcf8ec95d2661318e365f60850fe30608f
Author: Samir Parikh <noreply@samirparikh.com>
Date:   Wed,  1 Dec 2021 22:08:57 +0000

Merge branch 'dev'

Diffstat:
Mday01.pl | 9+--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/day01.pl b/day01.pl @@ -19,11 +19,4 @@ chomp( my @input = ( <$filehandle> ) ); say scalar( grep { $input[$_] > $input[$_ - 1] } (1 .. $#input) ); # Part 2 -say scalar( - grep { - my $overlap = $input[$_] + $input[$_ + 1]; - my $first_window = $overlap + $input[$_ - 1]; - my $second_window = $overlap + $input[$_ + 2]; - $second_window > $first_window - } (1 .. $#input - 2) -); +say scalar( grep { $input[$_ + 2] > $input[$_ - 1] } (1 .. $#input - 2) );