Python [EXPLAINED] | O(n)
Intuition \n- If we focus on a pattern :\n- a = 5 [0 1 0]\n- b = 7 [1 1 1]\n- c = a^b -> 2 [0 1 0]\n- c^a = 7 -> [1 1 1] = b\n\n- so for every pair of digits we
# Intuition \n- If we focus on a pattern :\n- `a = 5 [0 1 0]`\n- `b = 7 [1 1 1]`\n- `c = a^b -> 2 [0 1 0]`\n- `c^a = 7 -> [1 1 1] = b`\n\n- so for every pair of digits we are already given `a` and `c` we just have to find `b`, that we can easily calculate with the aforementioned method.\n\n- It is just similar to we are given `a = 5`, `b = 7` and `c = a+b`  and we have to find the value of `c`.\n- So `c = a+b` that is `c = 12.`\n\n# Approach\n- here we need to calculate prefix xor repeatedly so we can use a variable `XOR` to save time.\n- We will iterate through the array and we already have prefix xor in our `XOR` varible so `ans[i] = array[i]^XOR`.\n- then we will update `XOR` to `XOR = XOR^ans[i]`.\n\n- Here `a = arra[i]`, `b = XOR`, `c = a^b` and we have to find the value of `c` that is `ans[i]`.\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\n# Code\n```\nclass Solution:\n    def findArray(self, pref: List[int]) -> List[int]:\n        xor = 0\n        ans = []\n        for i in range(len(pref)):\n            ans.append(pref[i]^xor)\n            xor ^= ans[i]\n        return ans\n```\n------------------\n**Upvote the post if you find it helpful.\nHappy coding.**
['Bit Manipulation', 'Python3']