human
Number of Subsequences with Even and Odd Sum | Returns the count of odd and even subsequences.
Initialising count_even and count_odd to 0 since as there is no subsequence before the iteration with even or odd count ..
Find sum of all subsequences with even count and odd count and storing them as we iterate ..
if the number is even.
if the number is odd.
Driver code.
Calling the function"
Solution in Python:
assistant
#Here is code to number of Subsequences with Even and Odd Sum and the other steps required.
 def countSum ( arr , n ) :
	result = 0
	count_odd = 0
	count_even = 0
	for i in range ( 1 , n + 1 ) :
		if ( arr [ i - 1 ] % 2 == 0 ) :
			count_even = count_even + count_even + 1
			count_odd = count_odd + count_odd
		else :
			temp = count_even
			count_even = count_even + count_odd
			count_odd = count_odd + temp + 1
	return ( count_even , count_odd )
arr = [ 1 , 2 , 2 , 3 ] ;
n = len ( arr )
count_even , count_odd = countSum ( arr , n ) ;
print ( " EvenSum ▁ = ▁ " , count_even , " ▁ OddSum ▁ = ▁ " , count_odd )