You are viewing a single comment's thread. Return to all comments →
Slightly simpler O(n) python3 code
def divisibleSumPairs(n, k, ar): nums = [0] * k count = 0 for ele in ar: modu = ele % k count += nums[(k - modu) % k] nums[modu] += 1 return count
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
Slightly simpler O(n) python3 code