Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
leetcode: finished #735
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Jan 22, 2024
1 parent 8ca932a commit 82cd6e4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions content/leetcode/2024/1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ title: 2024.1
draft: false
---

# 2024.1.22

```python
#
# @lc app=leetcode.cn id=735 lang=python3
#
# [735] 小行星碰撞
#


# @lc code=start
class Solution:
def asteroidCollision(self, asteroids: List[int]) -> List[int]:
stack = []
for a in asteroids:
while stack and a < 0 < stack[-1]:
if stack[-1] < -a:
stack.pop()
continue
elif stack[-1] == -a:
stack.pop()
break
else:
stack.append(a)
return stack


# @lc code=end
```

# 2024.1.21

```python
Expand Down

0 comments on commit 82cd6e4

Please sign in to comment.