NvidiaOA #3
Reconstruct Array from Prefix XOR
估计简单可在线判题
考点(AI 标注)位运算
pref[i] is the XOR of elements 0 through i of the original array. Return the original array.
This site uses a standard input/output protocol.
输入格式
The first line contains N (1..100000), and the second line contains N values pref[i] (0..10⁹). Recovered values may exceed 10⁹ but are less than 2³⁰.
输出格式
Output N non-negative integers.
样例 1
输入:
4
2 2 5 6
输出:
2 0 7 3
样例 2
输入:
1
0
输出:
0
样例 3
输入:
3
7 0 7
输出:
7 7 7
样例说明
Example 1: the elements are 2, 0, 7, 3. Example 2: the only element is 0. Example 3: the prefix XORs of the original array 7, 7, 7 are 7, 0, 7.