✅✅Faster || Easy To Understand || C++ Code
Using Bit Manipulation\n\n Time Complexity :- O(N)\n\n Space Complexity :- O(N)\n\n\nclass Solution {\npublic:\n    vector<int> findArray(vector<int>& pref) {\n
* ***Using Bit Manipulation***\n\n* ***Time Complexity :- O(N)***\n\n* ***Space Complexity :- O(N)***\n\n```\nclass Solution {\npublic:\n    vector<int> findArray(vector<int>& pref) {\n        \n        int n = pref.size();\n        \n        // we know that (x ^ x == 0)\n        \n        // let say pref[i] = (a ^ b ^ c ^ d) and pref[i - 1] = (a ^ b ^ c), when we will do (pref[i] ^ pref[i - 1]) i.e. (a ^ b ^ c ^ d ^ a ^ b ^ c) club the pairs like (a ^ a ^ b ^ b ^ c ^ c ^ d) it will become (d)\n        \n        // perform the same operation to find every element of array\n        \n        vector<int> arr(n);\n        \n        arr[0] = pref[0];\n        \n        for(int i = 1; i < n; i++)\n        {\n            arr[i] = (pref[i] ^ pref[i - 1]);\n        }\n        \n        return arr;\n    }\n};\n```
['Bit Manipulation', 'C', 'C++']