An array xor problem.

Revision en2, by Confused101, 2016-12-16 02:20:35
Given an Array A of n elements, (n < 200000), At each step I can transform whole array such that  for every i <= 0 < n, A[i] = A[i - 1] xor A[i + 1]. Is it possible to convert whole array to 000....0 (all zeros) after infinite steps. for example if A = [ 0, 1, 0, 0, 0, 1, 0 ], 
Initial: A = [ 0, 1, 0, 0, 0, 1, 0 ] 
Step 1 : A = [ 1, 0, 1, 0, 1, 0, 1 ] 
Step 2 : A = [ 0, 0, 0, 0, 0, 0, 0 ]

So A can be transferred to zeros after 2 steps.

PS. Consider A[-1] = A[n] = 0, always

I would be highly thankful if someone helps me to solve this task. I saw this problem few days back, will post its link if I found it.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Confused101 2016-12-16 02:20:35 131
en1 English Confused101 2016-12-16 02:05:36 598 Initial revision (published)