Question bank › Monotonic Stack
Dsa Monotonic Stack Medium

Temperature Fluctuations

Given an array of integers representing daily temperatures, return an array where each element at index i represents the number of days until a warmer temperature. If there is no future day for which this is possible, put 0 instead. For example, given the input: 5 73 74 75 71 69 72 76 73 You should return: 1 1 4 2 1 1 0 Input Format: - The first line contains an integer n (1 ≤ n ≤ 30000), the number of days. - The second line contains n space-separated integers, representing the temperatures. Output Format: - A single line of n integers representing the number of days until a warmer temperature for each day.

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.