A original of length n is transformed into a derived binary array derived of length n by computing the bitwise $ ext{XOR}$ of adjacent elements:
For each index i such that i derived[i] original[i] original[i + 1].
For the last index n - 1, derived[n - 1] original[n - 1] original[0].
Given the array derived, return true if there exists a valid binary array original that could have produced derived, or false otherwise.
Constraints:
n derived.length
n
derived[i] is either i
A original of length n is transformed into a derived binary array derived of length n by computing the bitwise $ ext{XOR}$ of adjacent elements:
For each index i such that i derived[i] original[i] original[i + 1].
For the last index n - 1, derived[n - 1] original[n - 1] original[0].
Given the array derived, return true if there exists a valid binary array original that could have produced derived, or false otherwise.
Constraints:
n derived.length
n
derived[i] is either i