题目描述
Given a number N. Find the product of the number of setbits and the number itself.
Example 1:
Input: N = 2
Output: 2
Explaination: 2 has one setbit. So, 21 = 2.
Example 2:
Input: N = 3
Output: 6
Explaination: 3 has 2 setbits. 32 = 6.
Your Task:
You do not need to read input or print anything. Your task is to complete the function bitMultiply() which takes the number N as input parameters and returns the product.
Expected Time Complexity: O(Log N)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 10^{6}
输入格式
见题面
输出格式
见题面
样例输入
N = 2
样例输出
2