Quadruplet pair with XOR zero in the given Array | C # implementation of the approach ; Function that returns true if the array contains a valid quadruplet pair ; We can always find a valid quadruplet pair for array size greater than MAX ; For smaller size arrays , perform brute force ; Driver code
using System ; class GFG { static int MAX = 130 ; static Boolean validQuadruple ( int [ ] arr , int n ) { if ( n >= MAX ) return true ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) for ( int k = j + 1 ; k < n ; k ++ ) for ( int l = k + 1 ; l < n ; l ++ ) { if ( ( arr [ i ] ^ arr [ j ] ^ arr [ k ] ^ arr [ l ] ) == 0 ) { return true ; } } return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 0 , 2 , 3 , 7 } ; int n = arr . Length ; if ( validQuadruple ( arr , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }