Maximize modulus by replacing adjacent pairs with their modulus for any permutation of given Array | 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
function maximumModuloValue ( A , n ) { var mn = Number . MAX_VALUE ; for ( i = 0 ; i < n ; i ++ ) { mn = Math . min ( A [ i ] , mn ) ; } return mn ; } var A = [ 7 , 10 , 12 ] ; var n = A . length ; document . write ( maximumModuloValue ( A , n ) ) ;