C++ Solution
\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        sort(begin(asteroids),end(asteroids));\n        int i = 0;
```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        sort(begin(asteroids),end(asteroids));\n        int i = 0;\n        int n = asteroids.size();\n        long long a = mass;\n        while(i<n){\n            if(asteroids[i]>a) return false;\n            a+=asteroids[i];\n            i++;\n        }\n        return true;\n    }\n};\n```
[]