Maximize modulus by replacing adjacent pairs with their modulus for any permutation of given Array | Python3 program to implement the above approach ; Function to find the maximum value possible of the given expression from all permutations of the array ; Stores the minimum value from the array ; Return the answer ; Driver Code
import sys NEW_LINE def maximumModuloValue ( A , n ) : NEW_LINE INDENT mn = sys . maxsize NEW_LINE for i in range ( n ) : NEW_LINE INDENT mn = min ( A [ i ] , mn ) NEW_LINE DEDENT return mn NEW_LINE DEDENT A = [ 7 , 10 , 12 ] NEW_LINE n = len ( A ) NEW_LINE print ( maximumModuloValue ( A , n ) ) NEW_LINE