human
Find the two non | This function sets the values of * x and * y to non - repeating elements in an array arr [ ] of size n.
Xor all the elements of the array all the elements occuring twice will cancel out each other remaining two unnique numbers will be xored.
Bitwise & the sum with it ' s ▁ 2' s Complement Bitwise & will give us the sum containing only the rightmost set bit.
sum1 and sum2 will contains 2 unique elements elements initialized with 0 box number xored with 0 is number itself.
Traversing the array again.
Bitwise & the arr [ i ] with the sum Two possibilities either result == 0 or result > 0.
If result > 0 then arr [ i ] xored with the sum1.
If result == 0 then arr [ i ] xored with sum2.
Print the the two unique numbers.
Driver Code"
Solution in Python:
 Give me a code to find the two non and the other steps required?
assistant
#Here is code to find the two non and the other steps required.
 def UniqueNumbers2 ( arr , n ) :
	sums = 0
	for i in range ( 0 , n ) :
		sums = ( sums ^ arr [ i ] )
	sums = ( sums & - sums )
	sum1 = 0
	sum2 = 0
	for i in range ( 0 , len ( arr ) ) :
		if ( arr [ i ] & sums ) > 0 :
		sum1 = ( sum1 ^ arr [ i ] )
		else :
		sum2 = ( sum2 ^ arr [ i ] )
	print ( " The ▁ non - repeating ▁ elements ▁ are ▁ " , sum1 , " ▁ and ▁ " , sum2 )
if __name__ == " _ _ main _ _ " :
	arr = [ 2 , 3 , 7 , 9 , 11 , 2 , 3 , 11 ]
	n = len ( arr )
	UniqueNumbers2 ( arr , n )