Free written solution

Destroying Asteroids (LeetCode 2126): Solution and Explanation

A planet with mass mass collides with asteroids in any order you like. It destroys and absorbs each asteroid no heavier than itself, and is destroyed otherwise. Return whether it can destroy all of them.

Read the intuition, approach, code and complexity →