#K59487. Longest Consecutive Task Streak
Longest Consecutive Task Streak
Longest Consecutive Task Streak
You are given a list of task completion dates. Your task is to determine the longest streak of consecutive days on which at least one task was completed. Duplicate dates should be considered only once.
Formally, given an integer \( n \) and \( n \) date strings in the format \( YYYY\text{-}MM\text{-}DD \), compute the maximum integer \( L \) such that there exists a day \( d \) where every day from \( d \) to \( d+L-1 \) (inclusive) appears in the list.
inputFormat
The first line contains an integer \( n \) representing the number of tasks.
Each of the next \( n \) lines contains a date string in the format YYYY-MM-DD
.
outputFormat
Output a single integer representing the length of the longest consecutive day streak with at least one task completed.
## sample5
2023-01-01
2023-01-02
2023-01-03
2023-01-01
2023-01-05
3