human
Find the XOR of first half and second half elements of an array | Function to find the xor of the first half elements and second half elements of an array.
xor of elements in FirstHalfXOR.
xor of elements in SecondHalfXOR.
Driver Code.
Function call"
Solution in Python:
assistant
#Here is code to find the XOR of first half and second half elements of an array and the other steps required.
 def XOROfElements ( arr , n ) :
	FirstHalfXOR = 0 ;
	SecondHalfXOR = 0 ;
	for i in range ( n ) :
		if ( i < n // 2 ) :
			FirstHalfXOR ^= arr [ i ] ;
		else :
			SecondHalfXOR ^= arr [ i ] ;
	print ( FirstHalfXOR , " , " , SecondHalfXOR ) ;
arr = [ 20 , 30 , 50 , 10 , 55 , 15 , 42 ] ;
N = len ( arr ) ;
XOROfElements ( arr , N ) ;