C++✅ || Beats 50%💯|| 2 Lines Code💀💯|| Bit Manipulation🔥💯
💡 IntuitionThe given pref array represents the prefix XOR of the original array. We need to reconstruct the original array using the property:
[
arr[i] = pref[i
# 💡 Intuition
The given `pref` array represents the prefix XOR of the original array. We need to reconstruct the original array using the property:
\[
arr[i] = pref[i] \oplus pref[i-1]
\]
where `arr[0] = pref[0]`.

# 🔍 Approach
1. **Initialize the result array `ans`** with the first element of `pref`.
2. **Iterate from index 1 to n-1** and compute `arr[i]` using:
   \[
   arr[i] = pref[i] \oplus pref[i-1]
   \]
3. **Return the `ans` array** as the final result.

# ⏳ Complexity
- **Time Complexity:** \( O(n) \)  
  - We iterate through the `pref` array once.
- **Space Complexity:** \( O(n) \)  
  - We store the reconstructed array.

# 📝 Code
```cpp
class Solution {
public:
    vector<int> findArray(vector<int>& pref) {
        vector<int> ans;
        int n = pref.size();
        ans.push_back(pref[0]);
        for(int i = 1; i < n; i++) {
            ans.push_back(pref[i-1] ^ pref[i]);
        }
        return ans;
    }
};
```
![devinmeme.jpg](https://assets.leetcode.com/users/images/3631d2e8-2c1c-446f-93e6-97e33ddabff0_1741365092.2392378.jpeg)

['Array', 'Bit Manipulation', 'C++']