Given an array of n elements such that every element of array is an integer in the range 1 to n, find the sum of all the distinct elements of the array.
First line consists of T test cases. First line of every test case consists of N. Second line of every test case consists of elements of Array.
Single line output, print the sum of distinct element of array.
1 2 3 3 4
1 1 1 2 2
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.