Need help with INTXOR December Challenge

Hello…Can someone please help me with my IntXor logic which was asked in December18 Long Challenge.
Here is how I approached to the problem -
I found out that we can divide our arrays in lengths of 4,5 and 7 i.e when (N%4=0), (N%4=1),(N%4=2)(2 parts of length 5 each) and (N%4=3) respectively. Now I will ask my queries in the cyclic manner.
For eg - if part length = 4,then my queries will be
1 2 3 = a
2 3 4 = b
3 4 1 = c
4 1 2 = d
Here a,b,c,d are the answers of the queries. Now we can easily find the values of these 4 indices . For eg- A[1] = a^c^d, A[2] = a^b^d and so on…

if length = 7, queries will be

1 2 3 = a
2 3 4 = b
3 4 5 = c
4 5 6 = d
5 6 7 = e
6 7 1 = f
7 1 2 = g

Here, a[1] = a^c^d^f^g , a[2] = b^d^e^g^a, a[3] = c^e^f^a^b and so on in the cyclic manner…

if length = 5, queries will be
1 2 3 = a
2 3 4 = b
3 4 5 = c
4 5 1 = d
5 1 2 = e

Solving this part is somewhat tricky. But we can solve by first finding a single element and then using it to find the other elements. For eg - to find a[3] we can find it by using -
a^c.
This gives me the answer of 1^2^4^5. Therefore, my a[3] = a^b^c^d^e^a^c which is technically, b^d^e.
Now we can xor this answer we calculated for a[3] with c to get 4^5. Now, using this we can find a[1] because of the reversal property of xor and similarly we can find all the other elements.

However, I don’t know why all my TestCases weren’t accepted on submission. Kindly look into my code and please help if you find any fault in the logic or code. Thankyou :slight_smile:

Here is my code