Given an array of daily temperatures, return an array where each element is the number of days you'd have to wait after that day to reach a warmer temperature; if there's no future warmer day, use 0.
temperatures = [73,74,75,71,69,72,76,73][1,1,4,2,1,1,0,0]Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →A stack is last-in-first-out — the most recently added item is the first one removed. It's the natural fit whenever "the most recent unmatched thing" matters, like nested brackets or undo history.
Original problem on LeetCode ↗