human
Maximum even numbers present in any subarray of size K | Function to find the maximum count of even numbers from all the subarrays of size K.
Stores the maximum count of even numbers from all the subarrays of size K.
Generate all subarrays of size K.
Store count of even numbers in current subarray of size K.
Traverse the current subarray.
If current element is an even number.
Update the answer.
Return answer.
Driver Code.
Size of the input array"
Solution in Python:
assistant
#Here is code to maximum even numbers present in any subarray of size K and the other steps required.
 def maxEvenIntegers ( arr , N , K ) :
	ans = 0
	for i in range ( N - K + 1 ) :
		cnt = 0
		for j in range ( 0 , K ) :
			if arr [ i + j ] % 2 == 0 :
				cnt += 1
		ans = max ( cnt , ans )
	return ans
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 3 , 5 , 4 , 7 , 6 ]
	K = 3
	N = len ( arr )
	print ( maxEvenIntegers ( arr , N , K ) )