Find The Original Array of Prefix Xor

Medium · Bit Manipulation · about 10 minutes

Asked at Google, Amazon, Microsoft.

pref holds the running XORs of some hidden array arr: pref[i] is the XOR of arr[0] through arr[i]. Recover arr (only one array fits).