Fastest And simple solution C++


#1

int Solution::solve(vector &A)
{
long long int x=0;
if(A.size()%2==0)
{
return x;

}

for(int i=0;i<A.size();i=i+2)
{
    x=x^A[i];
}

return x;

}