Very short and simple code C++


#1

int Solution::solve(vector &A) {
int n=A.size();
int ans=0;
for(int i=0;i<n;i++){
if((!(i&1))&&(((n-i)&1)))ans^=A[i];
}
return ans;
}