You are viewing a single comment's thread. Return to all comments →
How about this? Here is my Python 3 code: I used combinations
def divisibleSumPairs(n, k, ar): sum_lst = list() res = list() comb_list = (list(combinations(ar, 2))) for i in comb_list: sum_lst.append(i[0] + i[1]) for i in sum_lst: if (i % k) == 0: res.append(i) return (len(res))
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 →
How about this? Here is my Python 3 code: I used combinations