Skip to content

Commit 5e48602

Browse files
committed
Create README - LeetHub
1 parent a154d8c commit 5e48602

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

0075-sort-colors/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h2><a href="https://leetcode.com/problems/sort-colors">75. Sort Colors</a></h2><h3>Medium</h3><hr><p>Given an array <code>nums</code> with <code>n</code> objects colored red, white, or blue, sort them <strong><a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank">in-place</a> </strong>so that objects of the same color are adjacent, with the colors in the order red, white, and blue.</p>
2+
3+
<p>We will use the integers <code>0</code>, <code>1</code>, and <code>2</code> to represent the color red, white, and blue, respectively.</p>
4+
5+
<p>You must solve this problem without using the library&#39;s sort function.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> nums = [2,0,2,1,1,0]
12+
<strong>Output:</strong> [0,0,1,1,2,2]
13+
</pre>
14+
15+
<p><strong class="example">Example 2:</strong></p>
16+
17+
<pre>
18+
<strong>Input:</strong> nums = [2,0,1]
19+
<strong>Output:</strong> [0,1,2]
20+
</pre>
21+
22+
<p>&nbsp;</p>
23+
<p><strong>Constraints:</strong></p>
24+
25+
<ul>
26+
<li><code>n == nums.length</code></li>
27+
<li><code>1 &lt;= n &lt;= 300</code></li>
28+
<li><code>nums[i]</code> is either <code>0</code>, <code>1</code>, or <code>2</code>.</li>
29+
</ul>
30+
31+
<p>&nbsp;</p>
32+
<p><strong>Follow up:</strong>&nbsp;Could you come up with a one-pass algorithm using only&nbsp;constant extra space?</p>

0 commit comments

Comments
 (0)