You're given an array of integers representing asteroids. The absolute value is the size, and the sign indicates direction: positive = right, negative = left. All asteroids move at the same speed. Amazon asks this to test stack-based collision simulation.
When asteroids meet, the smaller one explodes. If they're equal, both explode. Asteroids moving the same direction never meet. Return the state after all collisions.
[5, 10, -5] produces [5, 10] because the destroys the . [8, -8] produces [] because both are equal.
Collisions happen only when a right-moving asteroid is followed by a left-moving one. How do you process them efficiently?