Write a python function to find the number of (i, j) pairs where i


Topic: Write a python function to find the number of (i, j) pairs where i

Solution

def divisible_sum_pairs(arr, k):
    count = 0
    n = len(arr)
    for i in range(n - 1):
        j = i + 1
        while j < n:
            if ((arr[i] + arr[j]) % k) == 0:
                count += 1
            j += 1
    return count
import math



List all Python Programs