human
Length of longest subsequence whose XOR value is odd | Function for find max XOR subsequence having odd value.
Initialize odd and even count.
Count the number of odd and even numbers in given array.
If all values are odd in given array.
If all values are even in given array.
If both odd and even are present in given array.
Driver code.
Given array arr [ ].
Function Call"
Solution in Python:
 Can you provide a code to length of longest subsequence whose XOR value is odd and the other steps required?
assistant
#Here is code to length of longest subsequence whose XOR value is odd and the other steps required.
 def maxXorSubsequence ( arr , n ) :
	odd = 0
	even = 0
	for i in range ( 0 , n ) :
		if arr [ i ] % 2 != 0 :
			odd += 1
		else :
			even += 1
	if odd == n :
		if odd % 2 == 0 :
			maxlen = n - 1
		else :
			maxlen = n
	elif even == n :
		maxlen = 0
	else :
		if odd % 2 == 0 :
			maxlen = even + odd - 1
		else :
			maxlen = even + odd
	return maxlen
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 3 , 4 , 5 , 6 , 7 ]
	n = len ( arr )
	print ( maxXorSubsequence ( arr , n ) )