#K85407. Longest Even Subarray Problem

    ID: 36634 Type: Default 1000ms 256MiB

Longest Even Subarray Problem

Longest Even Subarray Problem

You are given an array of integers, and your task is to determine the length of the longest contiguous subarray that consists entirely of even numbers. In other words, find the maximum value L such that there exists a contiguous subarray \(a_i, a_{i+1}, \ldots, a_{i+L-1}\) where each \(a_j\) satisfies \(a_j \bmod 2 = 0\).

The input begins with an integer T denoting the number of test cases. For each test case, the first integer N indicates the number of elements in the array, followed by N integers. For each test case, print the length of the longest subsequence of consecutive even numbers.

Note: The subarray must be contiguous.

inputFormat

The first line of input contains a single integer T representing the number of test cases. Each test case is described as follows:

  • The first line contains an integer N, the number of elements in the array.
  • The next line contains N space-separated integers representing the array elements.

All input is read from stdin.

outputFormat

For each test case, output a single line with an integer indicating the length of the longest contiguous subarray consisting solely of even numbers. All output should be written to stdout.

## sample
2
10
1 2 4 6 1 2 2 3 4 4
5
2 4 6 8 10
3

5

</p>