arr of n non-negative integers, but only two things about it were kept:
- an array links of length n - 1, where links[i] = arr[i] XOR arr[i + 1];
- the first element, start = arr[0].
Rebuild and return the original array arr. It can be shown that it is determined uniquely.links=[5, 5, 0], start=3 → [3, 6, 3, 3]
3 XOR 5 = 6, 6 XOR 5 = 3, 3 XOR 0 = 3. Check: 3^6 = 5, 6^3 = 5, 3^3 = 0.
links=[8], start=0 → [0, 8]
With 0 as the first element, the second is 0 XOR 8 = 8.
links=[5, 5, 0], start=3
[3, 6, 3, 3]
Run checks the first 3 tests in your browser. Submit checks all 96 tests on the server, hidden ones included.