class Solution(object):
def dailyTemperatures(self, T):
"""
:type T: List[int]
:rtype: List[int]
"""
n = len(T)
result_a = []
result_b = [0]* n
for i in range(len(T)):
while result_a and T[i]>T[result_a[-1]]:
value = result_a.pop()
result_b[value] = i - value
# print(value)
result_a.append(i)
return result_b
每日一道Leetcode - 739. 每日温度【栈】
猜你喜欢
转载自blog.csdn.net/weixin_41041275/article/details/113073553
今日推荐
周排行