Easy to Understand Java n Python Solution
Java\n\nclass Solution {\n    public boolean asteroidsDestroyed(int mass, int[] asteroids) {\n        long res = mass;\n        Arrays.sort(asteroids);\n       
**Java**\n```\nclass Solution {\n    public boolean asteroidsDestroyed(int mass, int[] asteroids) {\n        long res = mass;\n        Arrays.sort(asteroids);\n        \n        for(int val:asteroids){\n            if(val > res) {\n              return false;  \n            }\n            else res += val;\n        }\n        \n        return true;\n    }\n}\n```\n**Python**\n```\nclass Solution:\n    def asteroidsDestroyed(self, mass: int, asteroids: List[int]) -> bool:\n        asteroids.sort()\n        for val in asteroids:\n            if val > mass:\n                return False\n            mass += val\n        return True\n```\n* **Time Complexity :-** BigO(NlogN) \n\n* **Space Complexity :-** BigO(N) using sorting Space
['Python', 'Java']