adventofcode/2018/01/sol2.pl
Yanick Champoux 292bca1eca day 1
2018-12-01 09:32:12 -05:00

17 lines
235 B
Perl

use List::AllUtils qw/ sum first /;
use 5.20.0;
my @nums = <>;
my $index = 0;
my %seen;
my $current = 0;
while() {
$current += $nums[ $index++ % @nums ];
say $current and last if $seen{$current};
$seen{$current}++;
}