Leetcode 2126: Destroying Asteroids
In this Leetcode problem we are trying to save the planet! We should determine if the planet can survive a series of asteroids. We can pick the order in which asteroids hit. This is the problem statement:
You are given an integer
mass
, which represents the original mass of a planet. You are further given an integer arrayasteroids
, whereasteroids[i]
is the mass of theith
asteroid.You can arrange for the planet to collide with the asteroids in any arbitrary order. If the mass of the planet is greater than or equal to the mass of the…