Easy Clean C++ Solution


#1
int Solution::solve(vector<int> &A) {
    long long ans=0,n=A.size(),prod;
    for(int i=0;i<A.size();i++){
        prod=(long long)(n-i)*(long long)(i+1);
        if(prod%2==1)ans^=A[i];
    }
    return ans;
}