You are viewing a single comment's thread. Return to all comments →
PHP
function divisibleSumPairs($n, $k, $ar) { $counter = 0; for ($i = 0; $i < $n - 1; $i++) { for ($j = $i + 1; $j < $n; $j++) { if (($ar[$i] + $ar[$j]) % $k == 0) { $counter++; } } } return $counter; }
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 →
PHP