Given an array having even number of integers.Find if the array has n / 2 pairs of integers such that each pair is divisible by a given number k.
Answers
Answered by
1
Input: arr[] = {92, 75, 65, 48, 45, 35},
k = 10
Output: True
We can divide array into (92, 48), (75, 65)
and (45, 35). Sum of all these pairs is a
multiple of 10.
Input: arr[] = {91, 74, 66, 48}, k = 10
Output: False
Input: arr[] = {9, 7, 5, 3},
k = 6
Output: True
We can divide array into (9, 3) and
(7, 5). Sum of both of these pairs
is a multiple of 6.
Similar questions