Question bank › Monotonic Stack
Dsa Monotonic Stack Hard

Temperature Variation

You are given an array of integers representing temperatures over a span of days. A day is warmer than another day if it has a higher temperature. For each day, determine how many days must pass before a warmer temperature occurs. If no warmer temperature exists in the future, return 0 for that day. Print the results for each day. Example: Input: 73 74 75 71 69 72 76 73 Output: 1 1 4 2 1 1 0 0 Input format: A single line containing space-separated integers representing daily temperatures. Output format: A single line containing space-separated integers corresponding to the days until a warmer day.

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