题目描述
Given two numbers A and B count all the number between the given range whose second least significant digit in the binary representation of the number is 1.
Example 1:
Input:
A = 1
B = 4
Output:
2
Explanation:
In the given range 2 (10)
and 3 (11) are the numbers
whose second least
significant digit in its
binary representation is 1.
Example 2:
Input:
A = 8
B = 10
Output:
1
Explanation:
In the given range 10 (1010)
is the number whose second
least significant digit in its
binary representation is 1
Your Task:
You don't need to read input or print anything. Your task is to complete the function find() which takes integers A, B as input parameters and returns the count of all the numbers between the given range whose second least significant digit in the binary representation of the number is 1.
Expected Time Complexity: O(1)
Expected Space Complexity: O(1)
Constraints:
1 <= A,B <= 10^{9}
输入格式
见题面
输出格式
见题面