Asteroid Collision (IMC Sydney )

Asteroid Collision (IMC Sydney) coding interview problem: Given arrays size and direction for asteroids moving left or right on a line, when opposing asteroids meet, larger destroys smaller; equal sizes both disappear. Determine and return the sizes of asteroids that remain in order. An interview question from Imc interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: