Question: Question 6 Max. score: 20.00 Minimum steps You have a starting number X. You can perform one of the following operations on it any number

 Question 6 Max. score: 20.00 Minimum steps You have a starting

number X. You can perform one of the following operations on it

any number of times: - Multiply by 2 - Divide X by

2 . ( X mst be even to perform this operation) Task

Question 6 Max. score: 20.00 Minimum steps You have a starting number X. You can perform one of the following operations on it any number of times: - Multiply by 2 - Divide X by 2 . ( X mst be even to perform this operation) Task Determine the minimum number of steps required to reach Y starting from X, or print 1 if it is not possible. Example Assumptions x=24 - Y=6 Approach - You can perform the operation of the second type twice to reach 6. It can be shown that it is not possible to reach 6 in less than 2 operations, so the answer is 2. Function description Complete the function solve provided in the editor. This function takes the following 2 parameters and returns the required answer: 0/8 Completed the following 2 parameters and returns the required answer: - Represents the value of X - Y Represents the value of Y Input format Note: This is the input format that you must use to provide custom input (available above the Compile and Test button). - The first line contains a single integer T which denotes the number of test cases. T also denotes the number of times you have to run the solve function on a different set of inputs. - For each test case: - The first line contains a single integer x denoting the value of X. - The second line contains a single integer Y denoting the value of Y. Output format For each test case, print a single line containing a single integer representing the answer. Constraints 1T105 1X,Y1018 x=24 y=16

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!