Pepper and Contiguous Even Subarray <Debugging>
Practice
3.3 (77 votes)
Arrays
Basic programming
Data structures
Easy
One Dimensional
Problem
80% Success 28567 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
62 votes
Tags:
Arrays1-DData Structures
Points:20
44 votes
Tags:
1-D ArrayArraysData StructuresEasyeasy
Points:20
26 votes
Tags:
ApprovedData StructuresEasyImplementationOne-dimensional