Prefix array to store the XOR values from array elements
prefix = [ 0 ] * n NEW_LINE x = 0 NEW_LINE for i in range ( n ) : NEW_LINE INDENT x ^= arr [ i ] NEW_LINE prefix [ i ] = x NEW_LINE DEDENT for i in range ( m ) : NEW_LINE INDENT queryResult ( prefix , Q [ i ] ) NEW_LINE DEDENT