human
Minimum sum of two numbers formed from digits of an array | Function to find and return minimum sum of two numbers formed from digits of the array ..
sort the array.
let two numbers be a and b.
Fill a and b with every alternate digit of input array.
return the sum.
Driver code"
How can the above be solved in Python?
 Give me a code to minimum sum of two numbers formed from digits of an array and the other steps required?
assistant
#Here is code to minimum sum of two numbers formed from digits of an array and the other steps required.
 def solve ( arr , n ) :
	arr . sort ( )
	a = 0 ; b = 0
	for i in range ( n ) :
		if ( i % 2 != 0 ) :
			a = a * 10 + arr [ i ]
		else :
			b = b * 10 + arr [ i ]
	return a + b
arr = [ 6 , 8 , 4 , 5 , 2 , 3 ]
n = len ( arr )
print ( " Sum ▁ is ▁ " , solve ( arr , n ) )