human
What is a code to pairs of Positive Negative values in an array and the other steps required given the following:
Pairs of Positive Negative values in an array | Print pair with negative and positive value.
For each element of array ..
Try to find the negative value of arr [ i ] from i + 1 to n.
If absolute values are equal print pair ..
If size of vector is 0 , therefore there is no element with positive negative value , print "0".
Sort the vector.
Print the pair with negative positive value ..
Driver Code"
Solution in Python:
assistant
#Here is code to pairs of Positive Negative values in an array and the other steps required.
 def printPairs ( arr , n ) :
	v = [ ]
	for i in range ( n ) :
		for j in range ( i + 1 , n ) :
			if ( abs ( arr [ i ] ) == abs ( arr [ j ] ) ) :
				v . append ( abs ( arr [ i ] ) )
	if ( len ( v ) == 0 ) :
		return ;
	v . sort ( )
	for i in range ( len ( v ) ) :
		print ( - v [ i ] , " " , v [ i ] , end = " ▁ " )
if __name__ == " _ _ main _ _ " :
	arr = [ 4 , 8 , 9 , - 4 , 1 , - 1 , - 8 , - 9 ]
	n = len ( arr )
	printPairs ( arr , n )