Count the total number of distinct pairs that can be formed from all contiguous sub-arrays consisting of distinct elements of an array A[ ] of size 'N'.
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 two space separated integers N, where N is the size of array.
The second line of each test case contains N space separated integers denoting elements of the array A[ ].
Print out the the number of pairs that can be formed with the elements of the corresponding sub-arrays.
1 <= T <= 100
1 <= N <= 30
0<= A[i] <= 10
3 3 4
1 4 2 4 3 2
1 2 2 3
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.