Skip to content

Commit 343a691

Browse files
committed
Create README - LeetHub
1 parent 640cbc8 commit 343a691

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

0735-asteroid-collision/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<h2><a href="https://leetcode.com/problems/asteroid-collision/">735. Asteroid Collision</a></h2><h3>Medium</h3><hr><div><p>We are given an array <code>asteroids</code> of integers representing asteroids in a row.</p>
2+
3+
<p>For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.</p>
4+
5+
<p>Find out the state of the asteroids after all collisions. 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.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre><strong>Input:</strong> asteroids = [5,10,-5]
11+
<strong>Output:</strong> [5,10]
12+
<strong>Explanation:</strong> The 10 and -5 collide resulting in 10. The 5 and 10 never collide.
13+
</pre>
14+
15+
<p><strong class="example">Example 2:</strong></p>
16+
17+
<pre><strong>Input:</strong> asteroids = [8,-8]
18+
<strong>Output:</strong> []
19+
<strong>Explanation:</strong> The 8 and -8 collide exploding each other.
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre><strong>Input:</strong> asteroids = [10,2,-5]
25+
<strong>Output:</strong> [10]
26+
<strong>Explanation:</strong> The 2 and -5 collide resulting in -5. The 10 and -5 collide resulting in 10.
27+
</pre>
28+
29+
<p>&nbsp;</p>
30+
<p><strong>Constraints:</strong></p>
31+
32+
<ul>
33+
<li><code>2 &lt;= asteroids.length &lt;= 10<sup>4</sup></code></li>
34+
<li><code>-1000 &lt;= asteroids[i] &lt;= 1000</code></li>
35+
<li><code>asteroids[i] != 0</code></li>
36+
</ul>
37+
</div>

0 commit comments

Comments
 (0)