Tap here to switch tabs
Problem
Submissions

Problem: XOR Operation in an Array

med
30 min
Try to solve the XOR Operation in an Array problem.

Statement

You are given an integer n and an integer start.

Define an array nums where nums[i] == start +2imesi+ 2 imes i for all 0≤i<0 \leq i < n.

Return the bitwise XOR of all elements in nums.

Constraints:

  • 1≤1 \leq n ≤1000\leq 1000

  • 0≤0 \leq start ≤1000\leq 1000

  • n ==== nums.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: XOR Operation in an Array

med
30 min
Try to solve the XOR Operation in an Array problem.

Statement

You are given an integer n and an integer start.

Define an array nums where nums[i] == start +2imesi+ 2 imes i for all 0≤i<0 \leq i < n.

Return the bitwise XOR of all elements in nums.

Constraints:

  • 1≤1 \leq n ≤1000\leq 1000

  • 0≤0 \leq start ≤1000\leq 1000

  • n ==== nums.length