We’re preparing your current view and syncing the latest data.
You are given an array of integers temperatures representing the daily temperatures. Your task is to return an array answer such that answer[i] is the number of days you have to wait after the i-th day to get a warmer temperature. If there is no future day for which this is possible, put 0 in answer[i].
An array of integers temperatures where 1 <= temperatures.length <= 100000 and each temperature is an integer in the range [30, 100].
An array of integers answer where answer[i] is the number of days until a warmer temperature, or 0 if none exists.
1 <= temperatures.length <= 10^5, 30 <= temperatures[i] <= 100
Example 1
Input
[73,74,75,71,69,72,76,73]
Output
[1,1,4,2,1,1,0,0]
Explanation
For day 0 (temperature 73), the next warmer temperature is on day 1 (74), so answer[0] = 1. For day 2 (75), the next warmer temperature is on day 6 (76), so answer[2] = 4, etc.