Toggle all the bits in the binary representation of a number
Given a number N, toggle all the bits to the right of the most significant bit (MSB) bit (and including MSB also) in the binary representation of the number. Input will be an integer N. Solution will be an integer having Ns all bits inverted after the MSB.
Please check out the video which explains the solution to this problem.
Please try solving this problem before jumping on the solution
Click to learn
Subscribe for more updates
Preparing for interviews? IDeserve team is here to help.
Create your profile
Create your profile, and here is what you will get:
1: Interview practice platform.
2: Once you are ready to take the interview, IDeserve team will help you get connected to the best job opportunities.
3: Personalized mentorship from IDeserve team once your interview process has started.
Creation of profile shouldn't take more than 2 minutes.