Given an array of integers and a positive integer , determine the number of pairs where and + is divisible by .
Three pairs meet the criteria: and .
Complete the divisibleSumPairs function in the editor below.
divisibleSumPairs has the following parameter(s):
- int n: the length of array
- int ar[n]: an array of integers
- int k: the integer divisor
- int: the number of pairs
The first line contains space-separated integers, and .
The second line contains space-separated integers, each a value of .
STDIN Function ----- -------- 6 3 n = 6, k = 3 1 3 2 6 1 2 ar = [1, 3, 2, 6, 1, 2]
Here are the valid pairs when :