Asteroid Collision
Medium
Stack
Asteroids move along a line; the sign gives the direction (positive = right, negative = left) and the absolute value the size. When two meet, the smaller explodes (equal sizes both explode); same-direction asteroids never meet. Print the asteroids that remain.
Constraints
2 <= n <= 10^4 -1000 <= value <= 1000, value != 0
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.