C++ sorting solution
\nWhen you sort the array, then you make sure that the everytime you add a new stone to the mass, the mass will be  greater than the stone being added.\nIf the 
\nWhen you sort the array, then you make sure that the everytime you add a new stone to the mass, the mass will be  greater than the stone being added.\nIf the mass is smaller than the stone being added to it, then we can return false, because all the numbers coming after the current index, will be larger than the  current stone. Also, the mass has the greatest possible weight at this point, that is has accumulated by adding all the stones smaller than it. \n\n\n```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& asteroids) {\n     long sum = mass; \n        sort(asteroids.begin(), asteroids.end()); \n        int n = asteroids.size(); \n        int i = 0; \n        while (i < n){\n            if (asteroids[i] <= sum){sum += asteroids[i];}\n            else return false;\n            i += 1; \n        }\n        return true; \n    }\n};\n```
[]