[Java] Two Solutions || Sorting and Without Sorting ||
By Sorting\njava\nclass Solution {\n    public boolean asteroidsDestroyed(int mass, int[] asteroids) {\n        Arrays.sort(asteroids);\n        long planetMass
1. By Sorting\n```java\nclass Solution {\n    public boolean asteroidsDestroyed(int mass, int[] asteroids) {\n        Arrays.sort(asteroids);\n        long planetMass = mass;\n        \n        for(int i : asteroids){\n            if(planetMass < i){\n                return false;\n            }\n            planetMass += i;\n        }\n        return true;\n    }\n}\n```\n\n2. Without Sorting\n```java\nclass Solution {\n    public boolean asteroidsDestroyed(int mass, int[] asteroids) {\n        int[] masses = new int[100001];\n        \n        for(int i : asteroids){\n            masses[i]++;\n        }\n        \n        int n = masses.length;\n        long planetMass = mass;\n        \n        for(int i=0 ; i<n ; i++){\n            if(masses[i] == 0){\n                continue;\n            }\n            if(planetMass < i){\n                return false;\n            }\n            planetMass += (i * masses[i]);\n        }\n        \n        return true;\n    }\n}\n```
['Greedy', 'Sorting', 'Counting Sort', 'Java']