adventofcode/2024/01/Part2.pm

18 lines
250 B
Perl
Raw Normal View History

2024-12-04 20:46:05 +00:00
package Day1::Part2;
use 5.36.0;
use List::Util qw/ sum pairmap /;
use List::MoreUtils qw/ part zip /;
sub solve($l1,$l2) {
my %occur;
$occur{$_}++ for @$l2;
no warnings qw/ uninitialized /;
sum map { $occur{$_}*$_ } @$l1;
}
1;