

python
class Solution:
def dailyTemperatures(self, temperatures: List[int]) -> List[int]:
st = []
ans = [0] * len(temperatures)
for i in range(len(temperatures)-1, -1, -1):
v = temperatures[i]
# 注意这里的>=
while st and v >= temperatures[st[-1]]:
st.pop()
if st:
ans[i] = st[-1] - i
st.append(i)
return ans