✅99.5% Beats🔥- Google - Bit Manipulation Solution 🔥🔥🔥
\n# Please Upvote It, if You find helpful :)\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the
\n# Please Upvote It, if You find helpful :)\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n![Screenshot 2023-10-31 065629.png](https://assets.leetcode.com/users/images/7774e852-7a04-4b40-81bf-40206ee02f9f_1698715576.0845609.png)\n  \nx1 = y0 ^ y1\nx2 = y1 ^ y2\nx3 = y2 ^ y3\nx4 = y3 ^ y4\nx5 = y4 ^ y5\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n) for Approach 1 and O(1) for Approach 2\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n// ***               Approach - 1            ***\nclass Solution {\npublic:\n    vector<int> findArray(vector<int>& pref) {\n        vector<int> ans;\n        ans.push_back(pref[0]);\n        for(int i = 1; i < pref.size(); i++)\n        {\n            int ele = pref[i-1] ^ pref[i];\n            ans.push_back(ele);\n        }\n        return ans;\n    }\n};\n\n// ***               Approach - 2            ***\n\nclass Solution {\npublic:\n    vector<int> findArray(vector<int>& pref) {\n        int curr = 0;\n        for(int i = 1; i < pref.size(); i++)\n        {\n            curr = curr ^ pref[i-1];\n            pref[i] = curr ^ pref[i];\n        }\n        return pref;\n    }\n};\n\n\n\n```
['C++']