Find the XOR of Numbers Which Appear Twice

EasyArrayHash TableBit Manipulation

Solution

export function duplicateNumbersXOR(nums: number[]): number {
  const arr = [...nums, ...new Set(nums)];
  return arr.reduce((acc, num) => acc ^ num, 0);
}