Longest Streak
Time limit1sMemory limit1024 MB
Given daily solve counts for N days, the task is to find the longest run of consecutive days with at least one solved problem.
- Level
Easy2 of 10
- Topics
- Implementation, Array
- Solved
- No attempts yet
Problem
The solved.ac site has a metric that shows how many consecutive days a user solved problems. This metric is called a streak. If you solved at least problem every day for a total of days, the streak is days.
The longest streak is the largest streak achieved within a period of days in total. Given the number of problems solved on each of the days, find the longest streak.
Input
The first line contains .
The second line contains , , , separated by spaces. is the number of problems solved on day .
Output
Print the longest streak.