XOR Operation in Array
Easy
Math
Math
Bit Manipulation
Given n and start, return start XOR (start+2) XOR (start+4) XOR ... XOR (start+2*(n-1)).
Constraints
1 ≤ n ≤ 1000
Examples
Example 1:
Input: 5
0
Output: 8
Example 2:
Input: 4
3
Output: 8
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console