Very Easy C++ soln....using map


#1

int Solution::solve(vector &A, int B) {
map<int,int>mp;
int n=A.size(),i;
mp.insert({0,1});

int x=0,ans=0;
if(B==0)
ans++;
for(i=0;i<n;i++)
{
    x=(x^A[i]);
    
    auto it=mp.find(B^x);
    if(it!=mp.end())
    {
        ans+=it->second;
    }
    mp[x]++;
}
return ans;

}


#2

very good solotion very nice simpla and ezy