Ice Cream
InterviewTime limit1sMemory limit1024 MB
Given N serial numbers, find the length of the longest contiguous run of even numbers in the sequence.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
Farmer John feeds his cows and plays a small game. He walks down the line of cows and reads the unique serial number on each cow's ear tag (they use ear tags now, not brands). He tries to guess the length of the longest contiguous run of even serial numbers. If he guesses right, he gets extra ice cream after dinner.
Given the number of cows () and the serial numbers, each in the range 1 to 1,000,000, find the length of the longest contiguous run of even serial numbers.
Input
The first line contains one integer . Each of the next lines contains one integer, the serial number of a cow.
Output
Print one line containing one integer, the length of the longest contiguous run of even serial numbers.