Search
⌘K

Leetcode 2126. Destroying Asteroids

Given a starting mass and asteroid masses, determine whether you can order collisions so the planet can sequentially absorb every asteroid (absorbing requires current mass >= asteroid and increases the planet's mass). The core challenge is a greedy cumulative-sum check (sort small-to-large) to see if the planet's mass can stay >= each next asteroid.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.