Given an array Arr of N distinct integers. Write a program to find the count of groups of 2 or 3 integers that can be formed by choosing integers from the given array such that sum of integers in each of the group is divisible by three.
First line of input contains a single integer T which denotes the number of test case. Then T test case follows. First line of each test case contains a single integer N which denotes number of elements in the array. Second line of each test case contains N space separated integers.
For each test case, print the count of all the groups of 2 or 3 integers formed from the given array such that sum of elements in the group is divisible by 3.
1 5 7 2 9 14
3 6 9 12
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.