You are viewing a single comment's thread. Return to all comments →
Perl:
sub pairs { my $k = shift; my $arr = shift; my $res = 0; my %h = map {$_ => 1} @$arr; foreach my $key (keys %h) { $res++ if (exists($h{$k + $key})); } return $res; }
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
Perl: