#K46927. Sum of Unique Elements
Sum of Unique Elements
Sum of Unique Elements
You are given t test cases. In each test case, you are first given an integer n which denotes the number of elements in an array. Then, you are given n integers which represent the array elements.
Your task is to compute the sum of all unique elements in the array. In mathematical notation, if \( U \) is the set of unique elements of the array, you need to calculate
$$ S = \sum_{x \in U}x $$
For each test case, output the sum on a separate line.
inputFormat
The first line of input contains an integer t (1 ≤ t ≤ 10), the number of test cases.
For each test case, the first line contains an integer n (0 ≤ n ≤ 105), the number of elements in the array. The second line contains n space-separated integers. Each integer will be in the range [-109, 109].
outputFormat
For each test case, output a single integer representing the sum of unique elements in the array.
## sample3
5
1 2 3 2 1
4
4 5 6 7
6
10 20 20 10 30 30
6
22
60
</p>