Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
1,323 views

For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in

 

image

 

in Online Assessments by Expert (44,360 points)

1 Answer

0 like 0 dislike

Binary Manipulation
Given an integer, store its binary representation bin as a string or an array with digits indexed from 0 to length(bin)-1. Reduce its binary representation to zero by using the following operations:

1. chage the ith binary digit only if (i+1)th bunary digit is 1 and all other binary digits from (i+2) to the end are zeros.
2. change the rightmost digit without restriction.

what are minimum number of operations required to complete the ask?

by Expert (44,360 points)
edited by
...