Hidden Number

1.7

3 votes
Very-Easy
Problem

Somnath does not like duplicates in his life. However, he has found a piece of paper where multiple integers are present. He observed and found out that all elements occurred thrice there except one element, which occurs just once.

He wishes to find that rogue integer. Help him find the element that occurs once.

Input Format
The first line contains a single integer, containing the number of testcases, T. Each test case contains 2 lines. The first line contains 1 integer, N. The next line contains N space separated integers.

Output Format
The output consists of just T lines. Each line consists of 1 integer, that is, the element that occurs once.

Constraints
1<=T<=105
1<=N<=105
1<=arr[i]<=105

Sample Input
1
7
1 2 3 3 2 1 4
Sample Output
4
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?