Minimum sum of product of elements of pairs of the given array | Function to find the minimum product ; Sort the array using STL sort ( ) function ; Initialise product to 1 ; Find product of sum of all pairs ; Return the product ; Driver code ; Function call to find product
def minimumProduct ( arr , n ) : NEW_LINE INDENT arr = sorted ( arr ) NEW_LINE product = 1 NEW_LINE for i in range ( 0 , n , 2 ) : NEW_LINE INDENT product *= ( arr [ i ] + arr [ i + 1 ] ) NEW_LINE DEDENT return product NEW_LINE DEDENT arr = [ 1 , 6 , 3 , 1 , 7 , 8 ] NEW_LINE n = len ( arr ) NEW_LINE print ( minimumProduct ( arr , n ) ) NEW_LINE