All Tracks Data Structures Arrays 1-D Problem

Pepper and Contiguous Even Subarray <Debugging>
/

Arrays, Basic Programming, Data Structures, One-dimensional

Problem
Editorial
Analytics

This is a DEBUGGING question.

You have an array of length N. A subarray is called Interesting if it contains only even numbers. You have to  find the maximum length of such Interesting subarray.

You are given a code which does the given task but has some bugs (errors). You have to make changes in the given function such that the code handles all the cases for errors and generate correct output every time.

Input
First line contains T , denoting number of test cases.
Each test case contains two lines:
    - First line contains an integer N denoting the size of the array.
    - Second line contains N space seperated integers denoting the value of array elements.

Ouput:
For each test case, print the maximum length of Interesting subarray. If no such subarray exist,print -1.

Input Constraints:

\(1 \le T \le 10\)

\(1 \le N \le 10^5\)

\(1 \le A[i] \le 10^6\)

Note:

The input and output is handled by the code itself. You are just supposed to correct the function.

SAMPLE INPUT
1
4
5 2 4 7
SAMPLE OUTPUT
2

Explanation

We can select 2nd and 3rd element as both are even numbers and form a subarray of length 2.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?