C++ better than editorial o(n)


#1

int Solution::solve(vector &A, int B) {
int s=0,ans=0;
unordered_map<int,int>m;
m[0]=1;
for(auto it:A){
s^=it;
if(m.find(s^B)!=m.end()){
ans+=m[s^B];
}
m[s]++;
}
return ans;
}