✅C++ | ✅Simple Approach
Please upvote if it helps :)\n\nLogic:\nif c = a^b then a = b^c\nso, ans[i] = ans[0]^ans[1]^...^ans[i-1]^pref[i]\n\nCode:\n\nclass Solution \n{\npublic:\n    ve
***Please upvote if it helps :)***\n\n**Logic:**\nif c = a^b then a = b^c\nso, ans[i] = ans[0]^ans[1]^...^ans[i-1]^pref[i]\n\n**Code:**\n```\nclass Solution \n{\npublic:\n    vector<int> findArray(vector<int>& pref) \n    {\n        int n = pref.size();\n        int pre_xor=0;\n        \n        for(int i=1; i<n; i++)\n        {\n            pre_xor ^= pref[i-1];\n            pref[i] = pre_xor^pref[i];\n        }\n        return pref;\n    }\n};\n```
['C', 'C++']