# 2126. Destroying Asteroids



T: O(nlogn)

S: O(1)

```java
class Solution {
    public boolean asteroidsDestroyed(int mass, int[] asteroids) {
        Arrays.sort(asteroids);
        long acc = (long)mass;
        for (int asteroid : asteroids) {
            if (acc >= asteroid) {
                acc += asteroid;
            } else {
                return false;
            }
        }
        return true;
    }
}
```
