Check if the given array is same as its inverse permutation | Function to check if the inverse permutation of the given array is same as the original array ; Check the if inverse permutation is not same ; Driver Code ; Function Call
function inverseEqual ( arr , n ) { for ( let i = 0 ; i < n ; i ++ ) if ( arr [ arr [ i ] - 1 ] != i + 1 ) return false ; return true ; } let n = 4 ; let arr = [ 1 , 4 , 3 , 2 ] ; document . write ( inverseEqual ( arr , n ) ? " " : " " ) ;