Easy Simple C++ Solution || O(nlogn) ✔✔
Complexity\n- Time complexity: O(nlogn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
## Complexity\n- Time complexity: $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n## Code\n```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        sort(asteroids.begin(),asteroids.end());\n        long long mass1= mass;\n        for (int i=0; i<asteroids.size(); i++){\n            if (mass1>=asteroids[i]){\n                mass1+= asteroids[i];\n            }\n            else return 0;\n        }\n        return 1;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'C++']