Skip to content

Instantly share code, notes, and snippets.

@Nasah-Kuma
Created September 14, 2022 21:15
Show Gist options
  • Save Nasah-Kuma/382668fb146e87e43392a7e1871d4152 to your computer and use it in GitHub Desktop.
Save Nasah-Kuma/382668fb146e87e43392a7e1871d4152 to your computer and use it in GitHub Desktop.
function divisibleSumPairs(n, k, ar) {
// Write your code here
let counter = 0;
for(let i = 0; i < n; i++) {
for (let j = i+1; j < n; j++) {
if ((ar[i]+ar[j]) % k === 0) counter++;
}
}
return counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment