You are viewing a single comment's thread. Return to all comments →
Slightly more pythonic:
res = sum((i+j)%k == 0 for x, i in enumerate(a) for j in a[x+1:])
Since True == 1
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 →
Slightly more pythonic:
res = sum((i+j)%k == 0 for x, i in enumerate(a) for j in a[x+1:])
Since True == 1