https://www.transtutors.com/ques ... -by-usi-8793076.htm
没有回答
Binary Manipulation Given an integer convenis binary representation to reto by using the following operations 1. Change the binary digit only if f1binary digitis 1 and all other tirsary digits from fit) to the end are 2. Change the rightmast digit without restriction What is the minimum number of operations required to complete this task? For example, let's say the given number is n& which has a binary representation of 1000. For this number, 15 operations are required to convert it to according to the above constraints. This can be seen in the following way: 1000-1001-1011-1010-1110-1111-1101-1100-0100 010130111 0110-0010001170001-0000 Note: In the binary representation of a number, the binary digit's positions are numbered as tox-1 from left to right, where x is the number of digits in the binary representation of the number Function Description Complete the function minOperations in the editor below. minOperations has the following parameter: long n: the starting value in base 10 Returns: int: the minimum number of operations required to covert nto 0 onstraints