Dsa
Monotonic Stack
Easy
Next Hot Day
Given a list of daily temperatures in degrees Celsius, for each day, determine how many days remain until the next day that has a higher temperature. If there isn't a next day with a higher temperature, return 0 for that day.
Input Format:
- A single line containing space-separated integers representing temperatures.
Output Format:
- A single line containing space-separated integers indicating the number of days until a warmer day.
Example:
Input:
70 75 72 68 80
Output:
1 1 2 1 0
Key concepts
monotonic_stackweather
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