Problem
You get an array of integers temperatures. The value temperatures[i] is the temperature on day i.
Return an array answer of the same length. The value answer[i] is the number of days from day i to the next warmer day. If no later day is warmer, answer[i] is 0.
Example 1
- Input:
- temperatures = [50,48,52,49,49,55,40]
- Output:
- [2,1,3,2,1,0,0]
- Explanation:
- On day 2, the temperature is 52. The next warmer day is day 5 with 55, so
answer[2]is 3.
Example 2
- Input:
- temperatures = [90,80,70]
- Output:
- [0,0,0]
- Explanation:
- The temperature only goes down, so no day has a warmer day after it.
Example 3
- Input:
- temperatures = [61,62,63]
- Output:
- [1,1,0]
Constraints
- 1 <= temperatures.length <= 10^5
- 30 <= temperatures[i] <= 100
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- 132 Pattern
Coding · Array · Binary Search · Monotonic Stack
- Beautiful Towers II
Coding · Array · Monotonic Stack · Stack
- Binary Searchable Numbers in an Unsorted Array
Coding · Array · Binary Search · Monotonic Stack
- Buildings With an Ocean View
Coding · Array · Monotonic Stack · Stack
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 739. Daily Temperatures
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 3 records
Anduril
Daily Temperatures
Reported date not specified · Source window: 6mo
Source snapshot: Oct 20, 2026
Source frequency score: 65.6. This is not an interview probability.
View sourceChime
Daily Temperatures
Reported date not specified · Source window: 6mo
Source snapshot: Oct 20, 2026
Source frequency score: 82.7. This is not an interview probability.
View sourceGoldman Sachs
Daily Temperatures
Reported date not specified · Source window: 6mo