human
Find smallest number formed by inverting digits of given number N | Function to invert the digits of integer N to form minimum possible number.
Initialize the array.
Iterate till the number N exists.
Last digit of the number N.
Checking if the digit is smaller than 9 - digit.
Store the smaller digit in the array.
Reduce the number each time.
Check if the digit starts with 0 or not.
Print the answer.
Driver Code.
Given Number.
Function Call"
Solution in Python:
assistant
#Here is code to find smallest number formed by inverting digits of given number N and the other steps required.
 def number ( num ) :
	a = [ 0 ] * 20
	r , i , j = 0 , 0 , 0
	while ( num > 0 ) :
		r = num % 10
		if ( 9 - r > r ) :
			a [ i ] = r
		else :
			a [ i ] = 9 - r
		i += 1
		num = num // 10
	if ( a [ i - 1 ] == 0 ) :
		print ( 9 , end = " " )
		i -= 1
	for j in range ( i - 1 , - 1 , - 1 ) :
		print ( a [ j ] , end = " " )
if __name__ == ' _ _ main _ _ ' :
	num = 4545
	number ( num )