You are viewing a single comment's thread. Return to all comments →
def divisibleSumPairs(n, k, ar): freq = [0] * k count = 0
for num in ar: mod = num % k complement = (k - num) % k count += freq[complement] freq[mod] += 1 return count
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 →
def divisibleSumPairs(n, k, ar): freq = [0] * k count = 0