human
Maximum sum of minimums of pairs in an array | Function to return the maximum required sum of the pairs.
Sort the array.
To store the sum.
Start making pairs of every two consecutive elements as n is even.
Minimum element of the current pair.
Return the maximum possible sum.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to maximum sum of minimums of pairs in an array and the other steps required.
 def maxSum ( a , n ) :
	a . sort ( ) ;
	sum = 0 ;
	for i in range ( 0 , n - 1 , 2 ) :
		sum += a [ i ] ;
	return sum ;
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 3 , 2 , 1 , 4 , 5 ] ;
	n = len ( arr ) ;
	print ( maxSum ( arr , n ) ) ;