Easy and clean solution | O(n)/O(n)✅
\n# Complexity\n- Time complexity: O(N), where N is the length of the pref array.\n\n- Space complexity: O(N), where N is the length of the pref array.\n Add yo
\n# Complexity\n- **Time complexity:** $$O(N)$$, where $$N$$ is the length of the `pref` array.\n\n- **Space complexity:** $$O(N)$$, where $$N$$ is the length of the `pref` array.\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n---\n\n```C# []\npublic class Solution {\n    public int[] FindArray(int[] pref) {\n        int[] result = new int[pref.Length];\n        result[0] = pref[0];\n        for(int i = 1; i < pref.Length; i++)\n        {\n            result[i] = pref[i] ^ pref[i-1];\n        }\n        return result;\n    }\n}\n```\n```C++ []\nclass Solution {\npublic:\n    vector<int> findArray(vector<int>& pref) {\n        std::vector<int> result(pref.size());\n        result[0] = pref[0];\n        for (int i = 1; i < pref.size(); i++) {\n            result[i] = pref[i] ^ pref[i - 1];\n        }\n        return result;\n    }\n};\n```\n```Python []\nclass Solution(object):\n    def findArray(self, pref):\n        result = [0] * len(pref)\n        result[0] = pref[0]\n        for i in range(1, len(pref)):\n            result[i] = pref[i] ^ pref[i - 1]\n        return result\n```\n```Javascript []\nvar findArray = function(pref) {\n    const result = new Array(pref.length);\n    result[0] = pref[0];\n    for (let i = 1; i < pref.length; i++) {\n        result[i] = pref[i] ^ pref[i - 1];\n    }\n    return result;\n};\n```\n\n---\n\n![Screenshot 2023-10-27 131722.png](https://assets.leetcode.com/users/images/5c538663-843a-4947-922e-67e80dc90189_1698759941.9829407.png)\n\n
['Array', 'Bit Manipulation', 'Python', 'C++', 'JavaScript', 'C#']