Rainy Streak
Easy · array
A weather station records the rainfall for each day in millimetres. You are given the list rain, where rain[i] is the rain on day i.
A rising streak is a run of consecutive days where every day has strictly more rain than the day before it. Equal rainfall does not continue a streak, it ends it. A single day on its own counts as a streak of length 1.
Return the length of the longest rising streak. If the list is empty, return 0.
Examples
Example 1
Input: rain = [2, 5, 7, 3, 4, 9, 10, 1]
Output: 4
Days 3 to 6 have 3, 4, 9, 10, each more than the one before. The first streak (2, 5, 7) is only 3 long.
Example 2
Input: rain = [4, 4, 4]
Output: 1
Equal values do not extend a streak, so each day is a streak of length 1.
Example 3
Input: rain = []
Output: 0
Constraints
- 0 <= len(rain) <= 10^5
- 0 <= rain[i] <= 10^4