C++ || in-place re-write from the back || fast 100% (98ms)
Approach 1:  in-place re-write from the back\n\npref[i] = arr[0] \oplus arr[1] \oplus \ldots \oplus arr[i] and if we xor this with pref[i - 1] = arr[0] \oplus a
### Approach 1:  in-place re-write from the back\n\n$$pref[i] = arr[0] \\oplus arr[1] \\oplus \\ldots \\oplus arr[i]$$ and if we xor this with $$pref[i - 1] = arr[0] \\oplus arr[1] \\oplus \\ldots \\oplus arr[i - 1]$$ we get $$arr[i]$$, and in the end $$arr[0] = pref[0]$$ already.\n\n```cpp\n    static vector<int> findArray(vector<int>& pref) {\n        for (int i = size(pref) - 1; i > 0; --i) {\n            pref[i] ^= pref[i - 1];\n        }\n        return pref;\n    }\n```\n\n**Complexity Analysis**\n  * Time complexity: $$O(n)$$, where $$n$$ is ```size(pref)```.\n  * Space complexity: $$O(1)$$ as we are not generating a new output vector.\n\n### Approach 2: std::adjacent_difference\n\nThis is based on a [post](https://leetcode.com/problems/find-the-original-array-of-prefix-xor/discuss/2682613/1-liner) by @andrii_khlevniuk, which is a great use of ```std::adjacent_difference```.\n\n```cpp\n    static vector<int> findArray(vector<int>& pref) {\n        adjacent_difference(begin(pref), end(pref), begin(pref), bit_xor());\n        return pref;\n    }\n```\n\nThe complexity is the same as above.\n\n_As always: Feedback, questions, and comments are welcome. Leaving an upvote sparks  joy! :)_\n\n**p.s. Join us on the [LeetCode The Hard Way Discord Server](https://discord.gg/Nqm4jJcyBf)!**\n
['C']