You are viewing a single comment's thread. Return to all comments →
In python using dictionary as bucket
def divisibleSumPairs(n, k, ar): d = {} c = 0 for i in ar: key = i % k if (k - key) % k in d: c += len(d[(k - key) % k]) d.setdefault(key, []).append(i) return c
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
In python using dictionary as bucket