Find the minimum value of the given expression over all pairs of the array | Function to find the minimum value of the expression ; Iterate over all the pairs and find the minimum value ; Driver code
function MinimumValue ( a , n ) { let answer = Number . MAX_SAFE_INTEGER ; for ( let i = 0 ; i < n ; i ++ ) { for ( let j = i + 1 ; j < n ; j ++ ) { answer = Math . min ( answer , ( ( a [ i ] & a [ j ] ) ^ ( a [ i ] a [ j ] ) ) ) ; } } return answer ; } let N = 6 ; let A = [ 12 , 3 , 14 , 5 , 9 , 8 ] ; document . write ( MinimumValue ( A , N ) ) ;