Subarray with Given XOR (IBit)
class Solution:
def solve(self, A, B):
rec = {0: [-1]}
cxor = 0
count = 0
for ix, n in enumerate(A):
cxor = cxor ^ n
if cxor ^ B in rec:
count = count + len(rec[cxor ^ B])
if cxor not in rec:
rec[cxor] = [ix]
continue
rec[cxor].append(ix)
return count