#K39907. Find the Unique Number
Find the Unique Number
Find the Unique Number
You are given a list of integers in which every integer appears exactly twice except for one number, which appears only once. Your task is to find and return the unique number for each test case. This problem can be elegantly solved using the bitwise XOR operation, since for any number a, a \oplus a = 0 and 0 \oplus a = a.
The input begins with an integer T denoting the number of test cases. For each test case, the first line contains an integer N (the size of the list) followed by a line of N space-separated integers. For every test case, output the unique number on a new line.
inputFormat
The first line of input contains an integer T, the number of test cases. Each test case consists of two lines:
- The first line contains an integer N, representing the number of integers in the list.
- The second line contains N space-separated integers.
It is guaranteed that in each list, every integer appears exactly twice except one that appears only once.
outputFormat
For each test case, print the unique number on a new line.
## sample3
5
1 2 2 3 1
7
4 3 4 3 2 2 7
9
9 7 8 7 8 9 10 10 11
3
7
11
</p>