Skip to content

#739 - Daily Temperatures

MediumMonotonic Stack
Open on LeetCode

Given an array temperatures, return an array answer where answer[i] is the number of days you have to wait after day i to get a warmer temperature. If there is no future warmer day, answer[i] = 0.

InputOutput
temperatures = [73,74,75,71,69,72,76,73][1,1,4,2,1,1,0,0]
temperatures = [30,40,50,60][1,1,1,0]
temperatures = [30,60,90][1,1,0]

Released under the MIT License.