You are viewing a single comment's thread. Return to all comments →
Perl:
sub divisibleSumPairs { my ($n, $k, $s) = @_; my $res = 0; for (my $i = 0; $i < $n; $i++) { for (my $j = 0; $j < $n; $j++) { $res++ if ($i < $j && (($s->[$i] + $s->[$j]) % $k) == 0 ); } } return $res; }
Seems like cookies are disabled on this browser, please enable them to open this website
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
Perl: