Login

All Problems

Problem title

Difficulty

Avg time to solve

Cousins of Given Node in Binary Tree

Moderate

10 mins

Maximize Sum

Easy

15 mins

Product Array Puzzle

Easy

15 mins

Get Path using BFS

Easy

25 mins

Odd To Even

Easy

10 mins

Implement Atoi Function

Easy

10 mins

Stack using queue

Moderate

25 mins

Number of Flips

Easy

--

Count Even Odd

Moderate

20 mins

Reverse the order of words in a string

Easy

10 mins

Problem

Submissions

3

Problem Statement

```
If ‘A’ is 13(1101) and ‘B’ is 7(0111), The number of bits that should be flipped is 2(0111).
```

```
The first line of the input contains an integer, 'T,’ denoting the number of test cases.
The first line of each test case contains two integers, ‘A’ and ‘B’.
```

```
For each test case, print ‘an integer corresponding to the minimum number of swaps required.
Print the output of each test case in a separate line.
```

```
You do not need to print anything. It has already been taken care of. Just implement the given function.
```

```
1 <= T <= 10
1 <= ‘A’,’B’ <= 10^9.
Time limit: 1 sec
```

```
2
13 7
15 20
```

```
2
4
```

```
For the first test case,
The binary representation of 13 is 1101.
The binary representation of 7 is 0111.
So, we will change the 2nd and the 4th bit from the right to convert B into A.
Hence, the answer is 2.
For the second test case:
The binary representation of 20 is 10100.
The binary representation of 15 is 01111.
So, we will change the 1st,2nd,4th, and 5th bit from the right to convert B into A.
Hence, the answer is 4.
```

```
2
3 10
6 4
```

```
2
1
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code