Tap here to switch tabs
Problem
Submissions

Problem: XOR Operation in an Array

XOR Operation in an Array gives you a count and starting value, then forms an array of values increasing by two. Return the bitwise XOR of every value.

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

XOR Operation in an Array gives you a count and starting value, then forms an array of values increasing by two. Return the bitwise XOR of every value.

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