Maximize the sum of modulus with every Array element | Function to return the maximum sum of modulus with every array element ; Sum of array elements ; Return the answer ; Driver Code
def maxModulosum ( a , n ) : NEW_LINE INDENT sum1 = 0 ; NEW_LINE for i in range ( 0 , n ) : NEW_LINE INDENT sum1 += a [ i ] ; NEW_LINE DEDENT return sum1 - n ; NEW_LINE DEDENT a = [ 3 , 4 , 6 ] ; NEW_LINE n = len ( a ) ; NEW_LINE print ( maxModulosum ( a , n ) ) ; NEW_LINE