C++ stack with sorting solution ACCEPTED😍
class Solution {\npublic:\n\n    bool asteroidsDestroyed(int val, vector& nums) {\n        long long mass = val;\n        sort(nums.begin() , nums.end());\n    
class Solution {\npublic:\n\n    bool asteroidsDestroyed(int val, vector<int>& nums) {\n        long long mass = val;\n        sort(nums.begin() , nums.end());\n        stack<int>st;\n        for(int i=nums.size()-1 ; i>=0 ; i--){\n            if(mass >= nums[i]){\n                mass += nums[i];\n                while(!st.empty() and st.top() <= mass){\n                    mass += st.top();\n                    st.pop();\n                }\n            }else{\n                st.push(nums[i]);\n            }\n        }\n        while(!st.empty() and st.top() <= mass){\n            mass += st.top();\n            st.pop();\n        }\n        \n        return st.empty();\n    }\n};
['Stack', 'Greedy', 'C', 'Sorting']