XOR Operation in an Array

EasyMathBit Manipulation

Solution

export function xorOperation(n: number, start: number): number {
  const nums = Array.from({ length: n }, (_, i) => start + 2 * i);
  return nums.reduce((prev, num) => prev ^ num, 0);
}