You are given an integer mass, which represents the initial mass of a planet. You are also given an integer array asteroids, where asteroids[i] is the mass of the
You can choose the order in which the planet collides with the asteroids. If the planet’s mass is greater than or equal to the mass of the colliding asteroid, the asteroid is destroyed, and the asteroid’s mass is added to the planet’s total mass. Otherwise, the planet is destroyed.
Return true if all asteroids can be destroyed, or false otherwise.
Constraints:
mass
asteroids.length
asteroids[i]
You are given an integer mass, which represents the initial mass of a planet. You are also given an integer array asteroids, where asteroids[i] is the mass of the
You can choose the order in which the planet collides with the asteroids. If the planet’s mass is greater than or equal to the mass of the colliding asteroid, the asteroid is destroyed, and the asteroid’s mass is added to the planet’s total mass. Otherwise, the planet is destroyed.
Return true if all asteroids can be destroyed, or false otherwise.
Constraints:
mass
asteroids.length
asteroids[i]