human
Convert a number m to n using minimum number of given operations | Function to find minimum number of given operations to convert m to n.
only way is to do - 1 ( m - n ) : times.
not possible.
n is greater and n is odd.
perform ' - 1' on m ( or + 1 on n ) :.
n is even.
perform ' * 2' on m ( or n / 2 on n ) :.
Driver code"
Solution in Python:
 ... Give me a code to convert a number m to n using minimum number of given operations and the other steps required?
assistant
#Here is code to convert a number m to n using minimum number of given operations and the other steps required.
 def conver ( m , n ) :
	if ( m == n ) :
		return 0
	if ( m > n ) :
		return m - n
	if ( m <= 0 and n > 0 ) :
		return - 1
	if ( n % 2 == 1 ) :
		return 1 + conver ( m , n + 1 )
	else :
		return 1 + conver ( m , n / 2 )
m = 3
n = 11
print ( " Minimum ▁ number ▁ of ▁ operations ▁ : " , conver ( m , n ) )