Quadruplet pair with XOR zero in the given Array | Javascript implementation of the approach ; Driver code
function check ( arr ) { let n = arr . length ; if ( n < 4 ) return false ; if ( n >= 130 ) return true ; let map = new Map ( ) ; for ( let i = 0 ; i < n - 1 ; i ++ ) { for ( let j = i + 1 ; j < n ; j ++ ) { let k = arr [ i ] ^ arr [ j ] ; if ( ! map . has ( k ) ) map . set ( k , [ ] ) ; let data = map . get ( k ) ; if ( ! data . includes ( i ) && ! data . includes ( j ) ) { data . push ( i ) ; data . push ( j ) ; if ( data . length >= 4 ) return true ; map . set ( k , data ) ; } } } return false ; } let arr = [ 1 , 0 , 2 , 3 , 7 ] ; if ( check ( arr ) ) document . write ( " " ) ; else document . write ( " " ) ;