Easy Solution using minheap
\n\n# Code\n\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& arr) {\n        priority_queue<int,vector<int>,greater<int>>  q;\n  
\n\n# Code\n```\nclass Solution {\npublic:\n    bool asteroidsDestroyed(int mass, vector<int>& arr) {\n        priority_queue<int,vector<int>,greater<int>>  q;\n        for(auto i: arr){\n            q.push(i);\n        }\n        \n        long long m=mass;\n        while(!q.empty()){\n            if(m>=q.top()){\n                m+=q.top();\n                q.pop();\n            }\n            else\n            return false;\n        }\n        return true;\n    }\n};\n```
['Heap (Priority Queue)', 'C++']