You are viewing a single comment's thread. Return to all comments →
What about this
return sum([1 for i,x in enumerate(ar) for y in ar[i+1:] if (x+y)%k == 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 →
return sum([1 for i,x in enumerate(ar) for y in ar[i+1:] if (x+y)%k == 0])