Computer Science, asked by abhay5711, 9 months ago

m=2
what is the meaning of it
in java programming
m = "+m);​

Answers

Answered by Iamavai
0

Answer:

number of given operations

Convert a number m to n with minimum operations. The operations allowed are :

Multiply by 2, i.e., do m = 2 * m

Subtract 1, i.e., do m = m – 1

Print -1 if it is not possible to convert.

Examples :

Input : m = 3, n = 11

Output : 3

1st operation: *2 = 3*2 = 6

2nd operation: *2 = 6*2 = 12

3rd operation: -1 = 12-1 = 11

Input : m = 15, n = 20

Output : 6

1st operation: -1 '5' times = 15 + (-1*5) = 10

2nd operation: *2 = 10*2 = 20

Input : m = 0, n = 8

Output : -1

Using the given set of operations 'm'

cannot be converted to 'n'

Input : m = 12, n = 8

Output : 4

Answered by ranipawarm123
0

Explanation:

remainder of number is divided by two which if something is divided by two the only remainder it could have either 0 or 1

Similar questions