Search
 
SCRIPT & CODE EXAMPLE
 

CPP

unique element in array in c

//using XOR
//you can fact check it on https://xor.pw/
#include<bits/stdc++.h>
using namespace std;
 
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
 
  int n,x,num=0;
  cin>>n;
  while(n--){
      cin>>x;
      num^=x;
  }
  cout<<num<<'
';

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ last element of array 
Cpp :: cpp language explained 
Cpp :: sort an array in c++ 
Cpp :: c++ initialize size of 3d vector 
Cpp :: c++ get index of map element 
Cpp :: gcd in cpp 
Cpp :: error in c++ 
Cpp :: bitmap 
Cpp :: remove duplicates from sorted list leetcode solution in c++ 
Cpp :: c++ map vector as keys 
Cpp :: summation of numbers using function 
Cpp :: C++ CHEAT SHEAT 
Cpp :: gtest assert not equal 
Cpp :: c++ iterate through constant list 
Cpp :: c++ file handiling 
Cpp :: new expression 
Cpp :: binary to int c++ bitset 
Cpp :: cap phat dong mang 2 chieu trong c++ 
Cpp :: true false operator 
Cpp :: pallindrome string 
Cpp :: https://www.cplusplus.com/doc/tutorial/pointers/ 
Cpp :: private access specifier in c++ program 
Cpp :: Check whether K-th bit is set or not c++ 
Cpp :: entering char in int c++ avoid loop 
Cpp :: assegnare valori in c++ 
Cpp :: Use of Scope Resolution operator for namespace 
Cpp :: c++ str 
Cpp :: check if a variable is tring c++ 
Cpp :: 1/2(-3-3)(-3+4) 
Cpp :: pcl c++ read .pcd 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =