P16372 [GeeksforGeeks] Find xor of numbers from l to r
普及-
题目描述

You are given two integers L and R, your task is to find the XOR of elements of the range [L, R].
Example:
Input:
L = 4, R = 8
Output:
8
Explanation:
4 ^ 5 ^ 6 ^ 7 ^ 8 = 8
Your Task:
Your task is to complete the function findXOR() which takes two integers l and r and returns the XOR of numbers from l to r.
^{Expected Time Complexity: O(1).}
^{Expected Auxiliary Space: O(1).}
Constraints:
1<=l<=r<=10^{9}

输入格式

见题面

输出格式

见题面

样例输入
L = 4, R = 8
样例输出
8