Days until a warmer day
Mediumstackmonotonic stackarray
For each day in temps, return how many days you must wait for a warmer one. If no warmer day follows, use 0.
Example 1
Input: temps = [73,74,75,71,69,72,76,73] Output: [1,1,4,2,1,1,0,0]
Example 2
Input: temps = [30,40,50,60] Output: [1,1,1,0]
Constraints
- 1 ≤ temps.length ≤ 10⁵
- 30 ≤ temps[i] ≤ 100
Submit checks your solution against 7 tests, including hidden ones.
/**
* @param {int[]} temps
* @return {int[]}
*/
function daysUntilWarmer(temps) {
}