题目描述
A number N is given. Find its Kth Least Significant Bit.
Example 1:
Input: N = 10, K = 4
Output: 1
Explanation: Binary Representation
of 10 is 1010. 4th LSB is 1.
Example 2:
Input: N = 16, K = 3
Output: 0
Explanation: Binary Representation of
16 is 10000. 3rd LSB is 0.
Your Task:
You don't need to read input or print anything. Your task is to complete the function KthLSB() which takes the N and K as inputs and returns the bit (1 or 0) in K'th LSB.
Expected Time Complexity: O(K)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 10^{9}
1 ≤ K ≤ 32
输入格式
见题面
输出格式
见题面
样例输入
N = 10, K = 4
样例输出
1