Maximize modulus by replacing adjacent pairs with their modulus for any permutation of given Array | C # 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
using System ; class GFG { static int maximumModuloValue ( int [ ] A , int n ) { int mn = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { mn = Math . Min ( A [ i ] , mn ) ; } return mn ; } public static void Main ( String [ ] args ) { int [ ] A = { 7 , 10 , 12 } ; int n = A . Length ; Console . WriteLine ( maximumModuloValue ( A , n ) ) ; } }