#K82107. Longest Even-Odd Subarray
Longest Even-Odd Subarray
Longest Even-Odd Subarray
Given an array of integers, your task is to find the length of the longest contiguous subarray that contains an equal number of even and odd numbers. In other words, if a subarray has ( k ) even numbers, it must also have ( k ) odd numbers. The solution should read input from standard input (stdin) and write the output to standard output (stdout).
inputFormat
The first line contains an integer ( n ) which represents the number of elements in the array. The second line contains ( n ) integers separated by spaces.
outputFormat
Output a single integer representing the length of the longest contiguous subarray with an equal number of even and odd numbers.## sample
10
1 2 3 4 5 6 7 8 9 10
10