Asteroid Collision - C++ Solution @ LeetCode
Asteroid Collision, is a LeetCode problem. In this post we will see how we can solve this challenge in C++
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). Each asteroid moves at the same speed.
Find out the state of the asteroids after all collisions. If two asteroids meet, the smaller one will explode. If both are the same s ....
You can find the full details of the problem Asteroid Collision at LeetCode
Solution: Please check the main.cpp snippet for the solution.
This solution originally posted at: Github by @kamyu104