Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
1,282 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,282 views

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