You are viewing a single comment's thread. Return to all comments →
Python - one line answer
from itertools import combinations ... def divisibleSumPairs(n, k, ar): return len([pair for pair in combinations(ar, 2) if (pair[0] + pair[1]) % k == 0])
Assuming that question statement is wrong because the question is considering i >= j
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
Python - one line answer
Assuming that question statement is wrong because the question is considering i >= j