• + 0 comments

    Perl:

    sub lonelyinteger {
        my $arr = shift;
        
        my %h;
        foreach (@$arr) {
            $h{$_} += 1;        
        }
        
        my ($tmp) = sort { $h{$a} <=> $h{$b} } keys %h;
    
        return $tmp;
    }