Simple XOR Approach
IntuitionWe are given a pref array, which represents prefix XOR values of some original array arr. Our goal is to find the original array.ApproachInitialize an
# Intuition
We are given a pref array, which represents prefix XOR values of some original array arr. Our goal is to find the original array.


# Approach
Initialize an array arr of the same size as pref.
Set arr[0] = pref[0] (since pref[0] is already the first value).
We can do this  =			ans[i] = pref[i] ^ pref[i-1];



# Code
```java []
class Solution {
    public static int[] findArray(int[] pref) {
        
    	int n = pref.length;
    	int ans[] = new int[n];
    	
    	ans[0] = pref[0];
    	
    	for (int i = 1; i < ans.length; i++) {
			ans[i] = pref[i] ^ pref[i-1];
		}
    	return ans;
    }
}
```
['Java']