C++ - Very simple sorting based O(NlogN) solution
\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        std::sort(asteroids.begin(), asteroids.end());\n        in
```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        std::sort(asteroids.begin(), asteroids.end());\n        int i = 0;\n        size_t cum_mass = mass;\n        while(i < asteroids.size()) {\n            if (cum_mass < asteroids[i]) {\n                return false;\n            }\n            cum_mass += asteroids[i];\n            i++;\n        }\n        \n        return true;\n    }\n};\n```
['Sorting']