Beat 100% of other submissions runtime.
IntuitionFirstly, we need to know what are the basic properties of xor operator, In xor operation, if x^y=z will always implies x^z=y and y^z=x. we will use thi
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Firstly, we need to know what are the basic properties of xor operator, In xor operation, if x^y=z will always implies x^z=y and y^z=x. we will use this property to solve this problem.

# Approach
<!-- Describe your approach to solving the problem. -->
Using above property we can simply solve this question, by traversing the array one by one index, 
As you can see in the solution in we will keep a xr variable which will keep xor of all the numbers in the new answer array which is helping at each  index to calculate the answer of next index.
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(N)

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(N)

# Code
```cpp []
class Solution {
public:
    vector<int> findArray(vector<int>& pref) {
        vector<int>ans(pref.size(),0);
        ans[0]=pref[0];
        int xr=ans[0];
        for(int ind=1;ind<pref.size();ind++){
            ans[ind]=xr^pref[ind];
            xr=xr^ans[ind];
        }
        return ans;
        
    }
};
```
['C++']