Dsa
Stack
Medium
Daily Temperature Tracker
You are given a list of daily temperatures in Celsius. For each day, you want to know how many days you need to wait until a warmer temperature. If there is no future day for which this is possible, put 0 for that day. Implement the function `daily_temperatures(temps: List[int]) -> List[int]`.
Input:
- A single line containing space-separated integers representing temperatures.
Output:
- A single line containing space-separated integers representing 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
stackarraytemperature
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