Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 294 Bytes

2433. Find The Original Array of Prefix Xor.md

File metadata and controls

16 lines (12 loc) · 294 Bytes

Code for ' 2433. Find The Original Array of Prefix Xor' (Java)

class Solution {
  public int[] findArray(int[] pref) {
    int[] ans = new int[pref.length];

    ans[0] = pref[0];
    for (int i = 1; i < ans.length; ++i)
      ans[i] = pref[i] ^ pref[i - 1];

    return ans;
  }
}