Decode XOR Permutation

A hidden permutation of the first n positive integers (where n is odd) was encoded by XORing adjacent elements: encoded[i] = perm[i] ^ perm[i + 1]. Reconstruct and return the original permutation. The answer is guaranteed to exist and be unique.

Examples
Input: [3,1]
Output: [1,2,3]
Hints

Decode XOR Permutation

A hidden permutation of the first `n` positive integers (where `n` is odd) was encoded by XORing adjacent elements: `encoded[i] = perm[i] ^ perm[i + 1]`. Reconstruct and return the original permutation. The answer is guaranteed to exist and be unique.