Subset with no pair sum divisible by K
Submissions: 355   Accuracy:

33.51%

  Difficulty: Easy   Marks: 2

Given an array of integers the task is to find maximum size of a subset such that sum of each pair of this subset is not divisible by K.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size of an array and the number k. The second line of each test case contains N space separated integers denoting elements of the array A[ ].


Output:
For each test case in a new line print the answer to each testcase. 

Constraints:
1<= T <=100
1<= N, K <=10000
1<= A[] <=1000000

Example:

Input :
2
5 3
3 7 2 9 1  
2 2
3 12

Output:
3
2

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sujnesh Mishra
Author: sujnesh


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.