[Java] Choose smallest asteroid first
Choose smallest asteroid first to gain more mass\n\nThen compare the mass of next asteroid\n\n\nclass Solution {\n  public boolean asteroidsDestroyed(int mass, 
Choose smallest asteroid first to gain more mass\n\nThen compare the mass of next asteroid\n\n```\nclass Solution {\n  public boolean asteroidsDestroyed(int mass, int[] asteroids) {\n    Arrays.sort(asteroids);\n    long left = mass;\n    for (int asteroid : asteroids) {\n      if (left >= asteroid) {\n        // gain more mass\n        left += asteroid;\n      } else {\n        return false;\n      }\n    }\n\n    return true;\n  }\n}\n```
['Greedy', 'Java']