C++ || GREEDY || SORTING || COMMENTED
```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector& asteroids) {\n        // if small asteroid can destroy the planet than large \n   
```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        // if small asteroid can destroy the planet than large \n        // asteroid can also destroy the planet \n        // thats the idea behind sorting\n        \n        sort(asteroids.begin(), asteroids.end());\n        \n        // edge case \n        if(asteroids[0] > mass) return false;\n       \n        int n = asteroids.size();\n        \n        // mass of planet can go out of int range so we need to typecast it\n        long long mss = mass;\n        for (int i = 0; i < n; i++)\n        {\n            if (asteroids[i] <= mss)\n                mss += asteroids[i];\n            else\n                return false;\n        }\n        return true;\n    }\n};
['Greedy', 'C', 'Sorting']