Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions problems/0739.每日温度.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ class Solution {
```

Python:
> 未精简版本

```python
class Solution:
Expand All @@ -291,6 +292,21 @@ class Solution:
return answer
```

> 精简版本

```python
class Solution:
def dailyTemperatures(self, temperatures: List[int]) -> List[int]:
answer = [0]*len(temperatures)
stack = []
for i in range(len(temperatures)):
while len(stack)>0 and temperatures[i] > temperatures[stack[-1]]:
answer[stack[-1]] = i - stack[-1]
stack.pop()
stack.append(i)
return answer
```

Go:

> 暴力法
Expand Down