Question
Given an array of integers representing asteroids in a row, the absolute value is each asteroid's size and the sign is its direction (positive = moving right, negative = moving left). All asteroids move at the same speed. When two asteroids collide, the smaller one explodes; if both are equal, both explode. Two asteroids moving in the same direction, or a left-mover to the left of a right-mover, never meet. Return the state of the asteroids after all collisions resolve.
asteroid_collision(asteroids: list[int]) → list[int][[5,10,-5]]out[5,10]State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.