Easiest Solution [ Java ] [ 88.64% ] [ 2ms ]
Approach\n1. Initialization:\n   - Create a new integer array arr with the same length as the input prefix XOR array pref.\n   - Set the first element of arr to
# Approach\n1. **Initialization**:\n   - Create a new integer array `arr` with the same length as the input prefix XOR array `pref`.\n   - Set the first element of `arr` to be the same as the first element of `pref`.\n\n2. **Iterate Through the Prefix XOR Array**:\n   - Start a loop from the second element (index 1) to the last element of the `pref` array.\n   - For each element at index `i` in `pref`:\n     - Calculate the current element of the original array by XORing the current element of `pref` (`pref[i]`) with the previous element of `pref` (`pref[i-1]`).\n     - Assign this calculated value to the corresponding index in the `arr` array.\n\n3. **Return the Result**:\n   - After the loop completes, return the `arr` array which now contains the original array.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    public int[] findArray(int[] pref) {\n        int arr[]=new int[pref.length];\n        arr[0]=pref[0];\n        for(int i=1; i<pref.length; i++){\n            int ele=pref[i]^pref[i-1];\n            arr[i]=ele;\n        }\n        return arr;\n    }\n}\n```\n\n\n![193730892e8675ebafc11519f6174bee5c4a5ab0.jpeg](https://assets.leetcode.com/users/images/90ede0e4-df33-4f9b-9450-3a69d5286d54_1718519514.2695522.jpeg)\n
['Java']