Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Compute the XOR of the numbers between 1 and n, and think about how it can be used. Let it be x.
Think why n is odd.
perm[0] = x XOR encoded[1] XOR encoded[3] XOR encoded[5] ...
perm[i] = perm[i-1] XOR encoded[i-1]