Even occurring elements
Submissions: 1746   Accuracy:

25.45%

  Difficulty: Basic   Marks: 1

Given an array that contains odd number of occurrences for all numbers except for a few elements which are present even number of times. Find the elements which have even occurrences in the array in O(n) time complexity and O(1) extra space.

Note: In some array, array contains only odd number then you have to print only a blank new line.

Input:
The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consist of two lines. The first line of each test case consists of an integer N, where N is the size of array. The second line of each test case contains N space separated integers denoting array elements.

Output:
Corresponding to each test case, in a new line, print the elements which have even occurrences in the array in sorted order.

Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 200
1 ≤ A[i] ≤ 63

Example:
Input
3
11
9 12 23 10 12 12 15 23 14 12 15
5
23 12 56 34 32
4
10 34 10 56

Output
12 15 23

10 

** For More Input/Output Examples Use 'Expected Output' option **

Author: rajatjha


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.