Dsa
Monotonic Stack
Easy
Temperature Spikes
Given a list of temperatures for a week, determine the longest sequence (in days) where the current day's temperature is higher than the day before. Return the length of that sequence.
Input format:
- A single line of integers, separated by spaces, representing daily temperatures.
Output format:
- A single integer showing the maximum length of consecutive days with increasing temperatures.
Example:
Input:
70 71 72 70 75 76 80
Output:
6
Key concepts
monotonic_stackarray
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