You are viewing a single comment's thread. Return to all comments →
Time: O(n^2)
def divisibleSumPairs(n, k, arr): count = 0 for i in range(len(arr)-1): for j in range(i+1, len(arr)): if (arr[i]+arr[j]) % k == 0: count += 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 →
Time: O(n^2)