You are viewing a single comment's thread. Return to all comments →
Perl:
sub missingNumbers { my $arr = shift; my $brr = shift; my (%h1, %h2); my @res; grep { $h1{$_} += 1; } @$arr; grep { $h2{$_} += 1; } @$brr; foreach my $e (keys %h2) { if (!exists($h1{$e})) { push(@res, $e); } elsif (exists($h1{$e}) && $h1{$e} != $h2{$e}) { push(@res, $e); } } return sort {$a <=> $b} @res; }
Seems like cookies are disabled on this browser, please enable them to open this website
Missing Numbers
You are viewing a single comment's thread. Return to all comments →
Perl: