[C++] XOR again
Intuition\n Describe your first thoughts on how to solve this problem. \n- pref[i] = arr[0] ^ arr[1] ^ ... ^ arr[i - 1] ^ arr[i]\n- pref[i - 1] = arr[0] ^ arr[1
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- `pref[i] = arr[0] ^ arr[1] ^ ... ^ arr[i - 1] ^ arr[i]`\n- `pref[i - 1] = arr[0] ^ arr[1] ^ ... ^ arr[i - 1]`\n- To get `arr[i]` we can biwise-xor `pref[i]` and `pref[i - 1]`\n  - `pref[i] ^ pref[i - 1]`\n  - ` = (arr[0] ^ arr[0]) ^ (arr[1] ^ arr[1]) ^ ... ^ (arr[i - 1] ^ arr[i - 1]) ^ arr[i]`\n  - ` = 0 ^ 0 ^ ... ^ 0 ^ arr[i]`\n  - ` = arr[i]` \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Base case: `i = 0`\n  - `arr[0] = pref[0]`\n- Normal case: `i = [1, n)`\n  - `arr[i] = pref[i - 1] ^ pref[i]`\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$ -> $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    // time/space: O(n)/O(n)\n    vector<int> findArray(vector<int>& pref) {\n        const int n = pref.size();\n        vector<int> arr(pref);\n        for (int i = 1; i < n; i++) arr[i] = pref[i - 1] ^ pref[i];\n        return arr;\n    }\n};\n```\n```\nclass Solution {\npublic:\n    // time/space: O(n)/O(1)\n    vector<int> findArray(vector<int>& pref) {\n        for (int i = pref.size() - 1; i > 0; i--) pref[i] ^= pref[i - 1];\n        return pref;\n    }\n};\n```
['Bit Manipulation', 'C++']