Decode XORed Array

EasyArrayBit Manipulation

Solution

export function decode(encoded: number[], first: number): number[] {
  const arr = [first];
  encoded.forEach((num, i) => {
    arr.push(num ^ arr[i]);
  });
  return arr;
}