Java Solution with explanation
Intuition :\n    Firstly by looking at the question and the examples, we can deduce that for a mass m we need to check the next smaller element in the array so 
**Intuition :**\n    Firstly by looking at the question and the examples, we can deduce that for a mass m we need to check the next smaller element in the array so that we can dissolve that asteroid in the planet. Now three cases arise:\n\n```\nCase 1: If all the asteroids are less than the mass of the planet \n        Solution : If this is the case then we can simply return true;\n        e.g mass = 10 asteroid = [1,2,3,4,5]\n            \n    Case 2: If all the asteroids are greater than the mass of the planet\n        Solution: If this is the case then we can simply return false because there is no asteroid that can be dissolved in the planet\n            e.g. mass = 2 asteroid = [3,4,5,6]\n            \n    Case 3: If none of the above cases come then we have to find the next smaller asteroid that can be dissolved in the planet until there is no asteroid left\n```\n\n**Approach**\n\nIf the look at the examples in the question we need asteroids less than mass of the planet in a descending order and asteroids that are greater than the mass of the planet in a ascending order.\n\nHere I have 2 PriorityQueues for the same i.e smaller and greater\n\tsmaller will have the all the asteroids that are less than the initial mass of the planet in a descending order\n\tand the greater will have all the asteroids that are greater than the initial mass of the planet in a ascending order\n\nNow we have to iterate the queues until one of them is empty and check the following condition\n1. if the current mass of the planet is greater than equal to first greater asteroid then dissolve that asteroid in the planet\n2. else dissolve the next smaller asteroid in the planet\n\n\n\n**Code :**\n\n```\nclass Solution {\n            \n    public boolean asteroidsDestroyed(int m, int[] asteroids) {\n        \n        PriorityQueue<Integer> smaller = new PriorityQueue<>((a,b) -> b - a);\n        PriorityQueue<Integer> greater = new PriorityQueue<>();\n        long mass = m;\n        for(int i : asteroids){\n            if(i <= mass) smaller.add(i);\n            else greater.add(i);\n        }\n        \n        if(greater.isEmpty()) return true;\n        if(smaller.isEmpty()) return false;\n        \n        while(!smaller.isEmpty() && !greater.isEmpty()){\n            if(mass >= greater.peek()){\n                mass += greater.poll();\n            }else {\n                mass += smaller.poll();\n            }\n        }\n        \n        if(greater.isEmpty()) return true;\n        \n        while(!greater.isEmpty()){\n            if(mass < greater.peek()) return false;\n            mass += greater.poll();\n        }\n        \n        return true;\n    }\n}\n```\n\nTime Complexity : O(n logn )\n\n***Please upvote if you like the solution***
[]