Subarray with given XOR Time : Space : 1234567891011int Solution::solve(vector<int> &A, int B) { unordered_map<int, int> freq{{0,1}}; int res = 0, now = 0; for(int i = 0; i < A.size(); i++) { now ^= A[i]; res += freq[now ^ B]; freq[now] += 1; } return res;}