P20779 [GeeksforGeeks] Ishaans curiosity0853
普及-
题目描述

Given 2 integers L, R as input, and find the bitwise OR of all the integers in the range [L, R] (both inclusive).
Example 1:
Input: L = 3, R = 8
Output: 15
Explanation: 3|4|5|6|7|8 = 15
​Example 2:
Input: L = 12, R = 18
Output: 31
Explanation: 12|13|14|15|16|17|18 = 31
Your Task:
You don't need to read input or print anything. Your task is to complete the function findBitwiseOR() which takes the L and R as inputs and returns the answer.
Expected Time Complexity: O(log R)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ L ≤ R ≤ 10^{12}

输入格式

见题面

输出格式

见题面

样例输入
L = 3, R = 8
样例输出
15