#K88272. Sum of Unique Elements
Sum of Unique Elements
Sum of Unique Elements
Given an array of non-negative integers, your task is to compute the sum of all unique elements in the array. For each test case, the unique elements are those that appear exactly once in the array.
Input: The first line contains an integer \(T\), representing the number of test cases. Each test case starts with an integer \(N\) (the number of elements), followed by a line with \(N\) space-separated non-negative integers.
Output: For each test case, output a single line containing the sum of the unique elements in the array.
Note: An element is considered unique if it occurs exactly once in the array.
inputFormat
The input begins with an integer \(T\) (\(1 \le T \le 10\)), the number of test cases. Each test case consists of two lines:
- The first line contains an integer \(N\) (\(1 \le N \le 10^5\)), the number of elements in the array.
- The second line contains \(N\) space-separated non-negative integers (each between 0 and \(10^6\)).
outputFormat
For each test case, output the sum of all unique elements in the corresponding array on a separate line.
The output should be printed to stdout.
## sample1
5
1 2 2 3 4
8
</p>