Clean Short C++ O(N) soln


#1
int Solution::solve(vector<int> &v, int k) {
    map<int, int>m;
	int ans = 0, curr = 0;
	m[0] = 1;
	for (int a : v)
	{
		curr ^= a;
		if (m[k ^ curr])
			ans += m[curr ^ k];
		m[curr]++;
	}
	return ans;
}

#2

Dude,
I have a doubt
Why we are doing m[0]=1??


#3

if curr=k then curr^k will be zero.