New update is available. Click here to update.

Posted: 7 Dec, 2020

Difficulty: Easy

```
The first line contains a single integer ‘T’ representing the number of test cases.
The first line of each test case will contain two integers ‘N’ and ‘K’ where ‘N’ denotes the number whose 0 to ‘K’th bits have to be set and ‘K’ indicates the limit upto where from 0th bit, the bits have to be set.
```

```
For each test case, print the number after 0 to Kth bits are set.
Output for every test case will be printed in a separate line.
```

```
You don’t need to print anything; It has already been taken care of.
```

```
Can you solve this using O(1) time and space complexity?
```

```
1 <= T <= 10
-10^9 <= N <= 10^9
1 <= K <= 31
Time limit: 1 sec
```

SIMILAR PROBLEMS

Detect Odd

Posted: 15 Apr, 2022

Difficulty: Moderate

Detect Odd

Posted: 15 Apr, 2022

Difficulty: Moderate

Ninja And The Clan

Posted: 17 Apr, 2022

Difficulty: Moderate

Check whether K-th bit is set or not

Posted: 20 May, 2022

Difficulty: Easy

Check whether K-th bit is set or not

Posted: 20 May, 2022

Difficulty: Easy

Maximum Element

Posted: 21 Jul, 2022

Difficulty: Moderate

XOR DARE

Posted: 3 Sep, 2022

Difficulty: Moderate

Popular Interview Problems: