human
Minimum swaps of same | Function to count the minimum swaps of same - indexed elements from arrays arr1 and arr2 required to make the sum of both the arrays even.
Store the sum of elements of the array arr1 and arr2 respectively.
Store the array sum of both the arrays.
If both sumArr1 and sumArr2 are even , pr0 and return.
If both sumArr1 and sumArr2 are odd and check for a pair with sum odd sum.
Stores if a pair with odd sum exists or not.
Traverse the array.
If a pair exists with odd sum , set flag = 1.
Print the answer and return.
For all other cases , pr - 1.
Driver code.
Function Call"
Solution in Python:
 ... What is a code to minimum swaps of same and the other steps required?
assistant
#Here is code to minimum swaps of same and the other steps required.
 def minimumSwaps ( arr1 , arr2 , n ) :
	sumArr1 = 0 ; sumArr2 = 0 ;
	for i in range ( n ) :
		sumArr1 += arr1 [ i ] ;
		sumArr2 += arr2 [ i ] ;
	if ( sumArr1 % 2 == 0 and sumArr2 % 2 == 0 ) :
		print ( 0 ) ;
		return ;
	if ( sumArr1 % 2 != 0 and sumArr2 % 2 != 0 ) :
		flag = - 1 ;
		for i in range ( n ) :
			if ( ( arr1 [ i ] + arr2 [ i ] ) % 2 == 1 ) :
				flag = 1 ;
				break ;
		print ( flag ) ;
		return ;
	print ( - 1 ) ;
if __name__ == ' _ _ main _ _ ' :
	arr1 = [ 11 , 14 , 20 , 2 ] ;
	arr2 = [ 5 , 9 , 6 , 3 ] ;
	N = len ( arr1 ) ;
	minimumSwaps ( arr1 , arr2 , N ) ;