Minimum cost to make array size 1 by removing larger of pairs | function to calculate the minimum cost ; Minimum cost is n - 1 multiplied with minimum element . ; driver code
def cost ( a , n ) : NEW_LINE INDENT return ( ( n - 1 ) * min ( a ) ) NEW_LINE DEDENT a = [ 4 , 3 , 2 ] NEW_LINE n = len ( a ) NEW_LINE print ( cost ( a , n ) ) NEW_LINE