← All challenges
✓ Solved
Longest Increasing Run
Find the longest stretch of strictly increasing numbers in a row.
🟠 HardDifficulty
The challenge
Given [1, 2, 1, 2, 3, 4, 1, 2], find the length of the longest run of consecutive, strictly increasing numbers, and print it. (The run 1, 2, 3, 4 in the middle is the longest here.)
🧠 Need a hint? (Python)
Keep a running "current streak" length and a "best so far". Walk the array with a for i in range(1, len(arr)) loop: if arr[i] > arr[i-1], extend the streak; otherwise reset it back to 1.
🚀
Like solving these?
Structured courses, hands-on exercises, and real multi-file projects are waiting -- your first project unlock is free.
Create a free account