You are given an array A of N positive and/or negative integers and a value K. The task is to find the count of all sub-arrays whose sum is divisible by K.
The first line of input contains an integer T denoting the number of test cases. Each test case contains two integers N and K where N denotes the number of elements in the array A. Next line contains space separated N elements in the array A.
Print an integer which denoted the number of such sub-arrays.
1 <= T <= 100
1 <= N <= 106
-106 <= Ai <= 106
1 <= K <= 106
3 2 1
2 2 2 2 2 2
Testcase 1: Only 1 is needed to move to top which makes the array sorted.
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.