One for loop,That's it || O(n) solution
Idea ::\n\nXor property::\n\nb = a^c => a=b^c;\n\nSince pref[i] = pref[i-1]^array[i] ,\ntherefore, array[i] = pref[i]^pre[i-1] \n\nwhere array[i] is ith element
**Idea ::**\n\nXor property::\n\nb = a^c => a=b^c;\n\nSince pref[i] = pref[i-1]^array[i] ,\ntherefore, array[i] = pref[i]^pre[i-1] \n\nwhere array[i] is ith element in desired array\n\n\n\n```\nclass Solution \n{\npublic:\n    vector<int> findArray(vector<int>& pref) \n    {\n        for(int i=pref.size()-1;i>=1;i--)\n            pref[i]=pref[i]^pref[i-1];\n        return pref;\n    }\n};\n```
['C++']