Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 541 Bytes

File metadata and controls

12 lines (9 loc) · 541 Bytes

Problem 12: Celestial Impact

Problem Statement

We are given an array asteroids of integers representing asteroids in a row. For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). If two asteroids meet, the smaller one explodes. If both are the same size, both explode.

Input Format

  • An array of integers asteroids.

Example

Input: asteroids = [5, 10, -5]
Output: [5, 10]
Explanation: 10 and -5 collide; 10 survives.