human
Minimum number of given moves required to reach ( 1 , 1 ) from ( X , Y ) | Function to count the number of steps required to convert ( x , y ) to ( 1 , 1 ).
Store the required result.
Iterate while both x and y are not equal to 0.
If x is greater than y.
Update count and value of x.
Otherwise.
Update count and value of y.
If both x and y > 1.
Print the result.
Driver Code.
Given X and Y"
Solution in Python:
 ... Can you provide a code to minimum number of given moves required to reach ( 1 , 1 ) from ( X , Y ) and the other steps required?
assistant
#Here is code to minimum number of given moves required to reach ( 1 , 1 ) from ( X , Y ) and the other steps required.
 def minimumSteps ( x , y ) :
	cnt = 0
	while ( x != 0 and y != 0 ) :
		if ( x > y ) :
			cnt += x / y
			x %= y
		else :
			cnt += y / x
			y %= x
	cnt -= 1
	if ( x > 1 or y > 1 ) :
		cnt = - 1
	print ( int ( cnt ) )
if __name__ == ' _ _ main _ _ ' :
	x = 3
	y = 1
	minimumSteps ( x , y )