Skip to content

Commit 27453b6

Browse files
committed
Create README - LeetHub
1 parent b799f3a commit 27453b6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

0912-sort-an-array/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2><a href="https://leetcode.com/problems/sort-an-array/">912. Sort an Array</a></h2><h3>Medium</h3><hr><p>Given an array of integers <code>nums</code>, sort the array in ascending order and return it.</p>
2+
3+
<p>You must solve the problem <strong>without using any built-in</strong> functions in <code>O(nlog(n))</code> time complexity and with the smallest space complexity possible.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> nums = [5,2,3,1]
10+
<strong>Output:</strong> [1,2,3,5]
11+
<strong>Explanation:</strong> After sorting the array, the positions of some numbers are not changed (for example, 2 and 3), while the positions of other numbers are changed (for example, 1 and 5).
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> nums = [5,1,1,2,0,0]
18+
<strong>Output:</strong> [0,0,1,1,2,5]
19+
<strong>Explanation:</strong> Note that the values of nums are not necessairly unique.
20+
</pre>
21+
22+
<p>&nbsp;</p>
23+
<p><strong>Constraints:</strong></p>
24+
25+
<ul>
26+
<li><code>1 &lt;= nums.length &lt;= 5 * 10<sup>4</sup></code></li>
27+
<li><code>-5 * 10<sup>4</sup> &lt;= nums[i] &lt;= 5 * 10<sup>4</sup></code></li>
28+
</ul>

0 commit comments

Comments
 (0)