Sort and Greedy, C++ Clean Code
Here int64_t (long long) is used to avoid overflow.\n\n    bool asteroidsDestroyed(int mass, vector& asteroids) {\n        sort(asteroids.begin(), asteroids.end
Here int64_t (long long) is used to avoid overflow.\n\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n        sort(asteroids.begin(), asteroids.end());\n        int64_t cur_mass = mass;\n        for(auto a : asteroids){\n            if(cur_mass >= a) cur_mass += a;\n            else return false;\n        }\n        return true;\n    }
['Greedy']