Daily Temperatures
For each temperature, return how many days until a strictly warmer day; return zero if none follows.
Example 1
temperatures = [60,60,61,59,70][2,1,2,1,0]Explanation
Equal 60 is not warmer: the first day waits two days for 61, and 59 waits one for 70.
Example 2
temperatures = [90,80,70][0,0,0]Explanation
Every later day is colder, so all waits are zero.
Example 3
temperatures = [40][0]Explanation
The single temperature has no later day.
Constraints
- 1 <= number of temperatures <= 100000
- Temperatures are 30..100
Function contract
dailyTemperaturesArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 35 cases, on your device.
[60,60,61,59,70]