• + 0 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