Skip to content

Commit fb08410

Browse files
refactor 735
1 parent c6bbb4d commit fb08410

File tree

1 file changed

+0
-43
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-43
lines changed

src/main/java/com/fishercoder/solutions/_735.java

-43
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,6 @@
22

33
import java.util.Stack;
44

5-
/**
6-
* 735. Asteroid Collision
7-
*
8-
* We are given an array asteroids of integers representing asteroids in a row.
9-
* For each asteroid, the absolute value represents its size, and the sign represents its direction
10-
* (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
11-
* Find out the state of the asteroids after all collisions.
12-
* If two asteroids meet, the smaller one will explode. If both are the same size, both will explode. Two asteroids moving in the same direction will never meet.
13-
14-
Example 1:
15-
Input:
16-
asteroids = [5, 10, -5]
17-
Output: [5, 10]
18-
Explanation:
19-
The 10 and -5 collide resulting in 10. The 5 and 10 never collide.
20-
21-
Example 2:
22-
Input:
23-
asteroids = [8, -8]
24-
Output: []
25-
Explanation:
26-
The 8 and -8 collide exploding each other.
27-
28-
Example 3:
29-
Input:
30-
asteroids = [10, 2, -5]
31-
Output: [10]
32-
Explanation:
33-
The 2 and -5 collide resulting in -5. The 10 and -5 collide resulting in 10.
34-
35-
Example 4:
36-
Input:
37-
asteroids = [-2, -1, 1, 2]
38-
Output: [-2, -1, 1, 2]
39-
Explanation:
40-
The -2 and -1 are moving left, while the 1 and 2 are moving right.
41-
Asteroids moving the same direction never meet, so no asteroids will meet each other.
42-
43-
Note:
44-
The length of asteroids will be at most 10000.
45-
Each asteroid will be a non-zero integer in the range [-1000, 1000]..
46-
47-
*/
485
public class _735 {
496
public static class Solution1 {
507
public int[] asteroidCollision(int[] asteroids) {

0 commit comments

Comments
 (0)