Recover Array from Prefix XOR

An array's prefix XOR values are given, where each element pref[i] is the XOR of all elements from index 0 to i in the hidden original array. Reconstruct the original array from its prefix XOR representation.

Examples
Input: [5,2,0,3,1]
Output: [5,7,2,3,2]
Hints

Recover Array from Prefix XOR

An array's prefix XOR values are given, where each element `pref[i]` is the XOR of all elements from index 0 to `i` in the hidden original array. Reconstruct the original array from its prefix XOR representation.