Kth LSB
Easy Accuracy: 25.22% Submissions: 2194 Points: 2

A number N is given. We need to print its ‘K’th Least Significant Bit.

Input : num = 10, k = 4 
Output : 1
Explanation : Binary Representation 
of 10 is 1010. 4th LSB is 1.

Input:
First line consists of T test cases. Single line input, two integers N and K.

Output:
Single line output, print the required output.

Constraints:
1<=T<=100
1<=N<=10^9

Example:
Input:

2
10 4
16 3
Output:
1
0

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.