Search
⌘K

Leetcode 2433. Find The Original Array of Prefix Xor

Given an array pref of prefix XORs where pref[i] = arr[0] ^ ... ^ arr[i], reconstruct the unique original array arr. Use the XOR cancellation property so arr[0]=pref[0] and for i>0 arr[i]=pref[i-1]^pref[i], yielding a linear-time solution.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.