😍BEATS 99.99% ✅|| EASY C++😊💯|| SIMPLE BEGINEER FRIENDLY🔥
\n# Approach :\n Describe your approach to solving the problem. \nif u have knowledge about XOR operation U will easily understand this solution. here xor is do
\n# Approach :\n<!-- Describe your approach to solving the problem. -->\nif u have knowledge about XOR operation U will easily understand this solution. here xor is done between \'i\'th and \'i-1\'th element. how it working lefts see.. \n\nLets pref[i]=6 and pref[i-1]=3. then it will convert as follow:\n\nSTEP 1: \n\n6 in binary as=110\n        3 in binary as=001\n\nSTEP 2: Performing pref[i] ^ pref[i-1]:\n\n1 ^ 0 = 1.\n1 ^ 1 = 0.\n0 ^ 1 = 1.\n\nhence final xor answer=101 that is = 5 \n\nhence 5 is the new number that encodes the bitwise differences between these two numbers 6 and 3.\n\nXOR table:\n\nX\tY\tX^Y\n0\t0\t0\n0\t1\t1\n1\t0\t1\n1\t1\t0\n\n\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> findArray(vector<int>& pref) {\n        vector<int> ans;\n        ans.push_back(pref[0]);\n\n        for(int i=1;i<pref.size();i++){\n            int t=pref[i]^pref[i-1];\n            ans.push_back(t);\n        }\n        return ans;\n    }\n};\n```\n![upvote1.jpg](https://assets.leetcode.com/users/images/77ea1c6e-e6b3-458f-ba06-400282610b8b_1698716177.022571.jpeg)\n
['Bit Manipulation', 'C++']