Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Asteroid Collision
Bookmark
Brute Force
Stack
In-Place
Input
[5, 10, -5]
[8, -8]
[10, 2, -5]
[-2, -1, 1, 2]
Custom
asteroids
=
[5, 10, -5]
0
1
2
5
10
-5
0
1
2
5
10
-5
0
1
2
5
10
-5
0
1
2
5
10
-5
i
pass 1
0
1
2
5
10
-5
i
pass 1
0
1
2
5
10
-5
i
pass 1
0
1
2
5
10
-5
return
"[5, 10]"
0
1
2
5
10
-5
return
"[5, 10]"
algo
master
.
io
Step:
Brute force: resolve the first collision, then rescan from the start
0 / 6
Input
[5, 10, -5]
[8, -8]
[10, 2, -5]
[-2, -1, 1, 2]
Custom
asteroids
=
[5, 10, -5]
0 / 6
algo
master
.
io
Step:
Brute force: resolve the first collision, then rescan from the start