You are viewing a single comment's thread. Return to all comments →
Easy to read python solution using itertools and list.count() method:
from itertools import combinations pairs = [sum(pair) % k for pair in combinations(a, 2)] print(pairs.count(0))
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 →
Easy to read python solution using itertools and list.count() method: