Dsa
Monotonic Stack
Hard
Room Temperature Fluctuation
Given a list of room temperatures recorded throughout the day, find the maximum increase in temperature that occurred between any two measurements later in the day compared to an earlier one. If there is no increase, return 0.
Input:
A single line containing space-separated integers representing temperatures.
Output:
A single integer that represents the maximum increase in temperature.
Example:
Input:
70 71 69 72 68 74 73 75
Output:
6
Key concepts
monotonic_stacktemperaturearray
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