Most efficient algorithm (Beats 100%)
Fastest of them all. (Beats 100.00% of users with TypeScript`)\n\n# Complexity\n- Time complexity: Not sure. Please comment\n Add your time complexity here, e.g
Fastest of them all. (**Beats 100.00% of users with TypeScript`**)\n\n# Complexity\n- Time complexity: Not sure. **Please comment**\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: Not sure. **Please comment**\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nfunction asteroidsDestroyed(mass: number, asteroids: number[]): boolean {\n    let biggerAsteroids: number[] = []\n\n    for (let asteroid of asteroids) {\n        if (asteroid <= mass) {\n            mass += asteroid;\n        } else {\n            biggerAsteroids.push(asteroid);\n        }\n    }\n\n    if (asteroids.length === biggerAsteroids.length) {\n        return false;\n    } else if (biggerAsteroids.length === 0) {\n        return true;\n    } else {\n        return asteroidsDestroyed(mass, biggerAsteroids);\n    }\n};\n```
['TypeScript', 'JavaScript']