`{"id":"63ebe916-f2cc-4541-af01-981f83f84d4b","name":"Flip Bits To Convert A To B","description":"1. You are given two numbers A and B.\r\n2. You have to print the count of bits needed to be flipped to convert 'A' to 'B'.\r\n","inputFormat":"2 numbers A and B","outputFormat":"A number","constraints":"-10^9 &lt;= A,B &lt;= 10^9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nint main(){\n\n int a,b;\n cin>>a>>b;\n\n //write your code here\n\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n int a = scn.nextInt();\r\n int b = scn.nextInt();\r\n\r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"57\r\n76","sampleOutput":"5\r\n","questionVideo":"https://www.youtube.com/embed/YvYGhJjQPTI?end=33","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"2e5e99a0-08f5-43d7-ad85-6da13f10c8e4","name":"Flip Bits To Convert A To B","slug":"flip-bits-to-convert-a-to-b","type":1}],"next":{"id":"32515c42-edb9-4136-a343-7cd33c31898b","name":"Flip Bits To Convert A to B MCQ","type":0,"slug":"flip-bits-to-convert-a-to-b-mcq"},"prev":{"id":"5e282007-4fbf-42e5-8db1-15943817f69d","name":"N Queens Using Bits","type":3,"slug":"n-queens-using-bits"}}}`

# Flip Bits To Convert A To B

1. You are given two numbers A and B. 2. You have to print the count of bits needed to be flipped to convert 'A' to 'B'.

`{"id":"63ebe916-f2cc-4541-af01-981f83f84d4b","name":"Flip Bits To Convert A To B","description":"1. You are given two numbers A and B.\r\n2. You have to print the count of bits needed to be flipped to convert 'A' to 'B'.\r\n","inputFormat":"2 numbers A and B","outputFormat":"A number","constraints":"-10^9 &lt;= A,B &lt;= 10^9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nint main(){\n\n int a,b;\n cin>>a>>b;\n\n //write your code here\n\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n Scanner scn = new Scanner(System.in);\r\n int a = scn.nextInt();\r\n int b = scn.nextInt();\r\n\r\n //write your code here\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"57\r\n76","sampleOutput":"5\r\n","questionVideo":"https://www.youtube.com/embed/YvYGhJjQPTI?end=33","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"2e5e99a0-08f5-43d7-ad85-6da13f10c8e4","name":"Flip Bits To Convert A To B","slug":"flip-bits-to-convert-a-to-b","type":1}],"next":{"id":"32515c42-edb9-4136-a343-7cd33c31898b","name":"Flip Bits To Convert A to B MCQ","type":0,"slug":"flip-bits-to-convert-a-to-b-mcq"},"prev":{"id":"5e282007-4fbf-42e5-8db1-15943817f69d","name":"N Queens Using Bits","type":3,"slug":"n-queens-using-bits"}}}`

Editor

# Flip Bits To Convert A To B

easy

1. You are given two numbers A and B. 2. You have to print the count of bits needed to be flipped to convert 'A' to 'B'.

## Constraints

-10^9 <= A,B <= 10^9

## Format

### Input

2 numbers A and B

A number

## Example

Sample Input

```.css-23h8hz{color:inherit;font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;}57 76```

### Sample Output

```.css-3oaykw{color:var(--chakra-colors-active-primary);font-size:0.875rem;line-height:1.125rem;letter-spacing:0.016rem;font-weight:var(--chakra-fontWeights-normal);white-space:pre-wrap;font-family:Monospace;}5 ```

Question Video

Discussions

Show Discussion

Related Resources