GeeksforGeeks Solution For Hard Domain .Below You Can Find The Solution Of School Basic ,Easy ,Medium . Or Hackerrank Solution You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers
Problem :- Finding the numbers
Submit Your Solution :- Click Here
Solution :-
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
long long int t,x,n,i,j,y;
cin>>t;
while(t--)
{
cin>>n;
x = 2*n+2;
long long int a[x];
for(i=0;i<x;i++)
{
cin>>a[i];
}
sort(a,a+x);
for(i=0;i<x;i=i+2)
{
y = a[i]^a[i+1];
if(y!=0)
{
cout<<a[i]<<" ";
i=i-1;
}
}
cout<<endl;
}
}
Output:-
0 Comments: