Question bank › Monotonic Stack
Dsa Monotonic Stack Hard

Nearest Warmer Day

You are given a list of integers representing daily temperatures. For each day in the input, you want to know how many days you have to wait until a warmer temperature. If there is no future day for which this is possible, keep 0 instead. Return the list of days you must wait. Input format: - A single line containing integers separated by spaces, representing daily temperatures. Output format: - A single line containing integers separated by spaces, representing the number of days to wait for a warmer temperature for each day. Example: Input: 73 74 75 71 69 72 76 73 Output: 1 1 4 2 1 1 0 0

Key concepts

monotonic_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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.