Dsa
Sliding Window
Easy
Maximal Rise Periods
You are provided with an array of integers representing stock prices over a number of days. Your task is to find the longest period of days in which stock prices are continuously rising. Return the length of this period.
Input Format:
- The first line contains an integer `n`, the number of days (i.e., number of prices).
- The second line contains `n` integers representing the stock prices.
Output Format:
- Output the length of the longest period of continuous rise as an integer.
Example:
Input:
7
100 101 102 100 102 103 104
Output:
4
Key concepts
sliding_windowarraystock_prices
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now