-
Create the stack that will hold the value of [ temperature, index ]
-
Create another list to store the result
-
enumerate through the list of temperatures
-
check if the stack has value and compare the topmost element with the current temperature
-
if the above check satisfies then pop the topmost element from the stack and store the value in separate variables update current result at popped index with current index - popped index
-
then, add value to the stack with temperature and index
-
return result.
739. Daily Tempratures
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||