Dsa
Monotonic Stack
Easy
Temperature Rise
Given a list of daily temperatures in degrees Celsius, your task is to determine the number of days until a warmer temperature. For each day, count how many days you have to wait for a warmer day. If there is no future day for which this is possible, return 0 for that day.
Input Format:
- A single line containing space-separated integers representing temperatures.
Output Format:
- A single line with space-separated integers where each integer represents the number of days to wait for a warmer temperature.
Example:
Input:
73 74 75 71 69 72 76 73
Output:
1 1 4 2 1 1 0 0
Key concepts
monotonic_stacktemperature
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