Series Generation and finding Xor using Python in minimum time complexity

XOR(a1..n)=a1⊕a2⊕⋯⊕an of sequence A with size N. We have to generate a new sequence B with size N^2 using the following formula: BiN+j+1=(Ai+1+Aj+1)∀ 0≤i,j

Example case 1: A= {1,2}

The sequence B is {A1+A1,A1+A2,A2+A1,A2+A2}={2,3,3,4}

The XOR of its elements is B1⊕B2⊕B3⊕B4=6

Author: Dreamer
Login to Answer
Sort By:
Oldest
|
Newest
|
Vote
|
My Answer