2126. Destroying Asteroids

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2126

class Solution:
    def asteroidsDestroyed(self, mass: int, asteroids: List[int]) -> bool:
        asteroids.sort()
        for v in asteroids:
            if mass < v:
                return False
            mass += v
        return True