← Back to all problems
Medium

Asteroid Collision

Updated Feb 24, 2026

Problem

Simulate asteroid collisions and return final state.

Constraints

2 <= asteroids.length <= 10^4

Examples

Example 1

Input: {"asteroids": [5, 10, -5]}
Output: [5, 10]

Function Signature

def asteroidCollision(self, asteroids: list[int]) -> list[int]

How to Submit

Implement a Solution class with a asteroidCollision method.

Your method will be called with the input parameters and should return the answer.