adventofcode/2020/05/part2.pm
2021-12-05 11:51:21 -05:00

27 lines
309 B
Perl

package part2;
use 5.20.0;
use warnings;
use experimental qw/
signatures
postderef
switch
/;
use part1;
sub solution(@codes) {
my @positions = sort { $a <=> $b } map { resolve($_) } @codes;
my $i = $positions[0];
for (@positions) {
return $_ - 1 if $_ != $i++;
}
}
1;