Longest price rally

Write codeMedium13 min

Your task

A price dashboard highlights the longest rally: the longest stretch of consecutive days where each day's price is strictly higher than the previous day's. Given the daily prices in order, return the length of that stretch. A single day counts as a stretch of length 1; an empty history returns 0. Example: [1, 2, 3, 1, 4, 5, 6, 7] returns 5 (the run 1, 4, 5, 6, 7).

Examples

longest_rally(prices: list[int]) -> int
Example 1
Inputlongest_rally([1, 2, 3, 1, 4, 5, 6, 7])
Output5