human
Find Unique pair in an array with pairs of numbers | Python 3 program to find a unique pair in an array of pairs ..
XOR each element and get XOR of two unique elements ( ans ).
Get a set bit of XOR ( We get the rightmost set bit ).
Now divide elements in two sets by comparing rightmost set bit of XOR with bit at same position in each element ..
XOR of first set in arr [ ].
XOR of second set in arr [ ].
Driver code"
Solution in Python:
 ... Give me a code to find Unique pair in an array with pairs of numbers and the other steps required?
assistant
#Here is code to find Unique pair in an array with pairs of numbers and the other steps required.
 def findUniquePair ( arr , n ) :
	XOR = arr [ 0 ]
	for i in range ( 1 , n ) :
		XOR = XOR ^ arr [ i ]
	set_bit_no = XOR & ~ ( XOR - 1 )
	x = 0
	y = 0
	for i in range ( 0 , n ) :
		if ( arr [ i ] & set_bit_no ) :
			x = x ^ arr [ i ]
		else :
			y = y ^ arr [ i ]
	print ( " The ▁ unique ▁ pair ▁ is ▁ ( " , x , " , ▁ " , y , " ) " , sep = " " )
a = [ 6 , 1 , 3 , 5 , 1 , 3 , 7 , 6 ]
n = len ( a )
findUniquePair ( a , n )