Created
September 14, 2022 21:15
-
-
Save Nasah-Kuma/382668fb146e87e43392a7e1871d4152 to your computer and use it in GitHub Desktop.
Divisible Sum Pairs Hackerrank Challenge: https://www.hackerrank.com/challenges/divisible-sum-pairs/problem?isFullScreen=true
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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