# \*\*Asteroid Collision (Leetcode 735)

Problem Link: <https://leetcode.com/problems/asteroid-collision/>

```python
class Solution:
    def asteroidCollision(self, asteroids: List[int]) -> List[int]:
        
        s=[]
        n=len(asteroids)
        
        # Collison occurs only when the top of the stack is +ve
        # and the curr element is -ve.
        
        for i in range(n):
            c=0
            while(len(s)>0 and s[-1]>0 and asteroids[i]<0):
                if(abs(s[-1])>abs(asteroids[i])):
                    c+=1
                    break
                elif(abs(s[-1])==abs(asteroids[i])):
                    c+=1
                    s.pop()
                    break
                elif(abs(s[-1])<abs(asteroids[i])):
                    s.pop()
            if(c==0):
                # If c
                s.append(asteroids[i])
        
        return s
```
