Skip to content

Commit 460fc37

Browse files
committed
Create README - LeetHub
1 parent 34a9133 commit 460fc37

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

0268-missing-number/README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<h2><a href="https://leetcode.com/problems/missing-number">268. Missing Number</a></h2><h3>Easy</h3><hr><p>Given an array <code>nums</code> containing <code>n</code> distinct numbers in the range <code>[0, n]</code>, return <em>the only number in the range that is missing from the array.</em></p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
6+
<pre>
7+
<strong>Input:</strong> nums = [3,0,1]
8+
<strong>Output:</strong> 2
9+
<strong>Explanation:</strong> n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.
10+
</pre>
11+
12+
<p><strong class="example">Example 2:</strong></p>
13+
14+
<pre>
15+
<strong>Input:</strong> nums = [0,1]
16+
<strong>Output:</strong> 2
17+
<strong>Explanation:</strong> n = 2 since there are 2 numbers, so all numbers are in the range [0,2]. 2 is the missing number in the range since it does not appear in nums.
18+
</pre>
19+
20+
<p><strong class="example">Example 3:</strong></p>
21+
22+
<pre>
23+
<strong>Input:</strong> nums = [9,6,4,2,3,5,7,0,1]
24+
<strong>Output:</strong> 8
25+
<strong>Explanation:</strong> n = 9 since there are 9 numbers, so all numbers are in the range [0,9]. 8 is the missing number in the range since it does not appear in nums.
26+
</pre>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Constraints:</strong></p>
30+
31+
<ul>
32+
<li><code>n == nums.length</code></li>
33+
<li><code>1 &lt;= n &lt;= 10<sup>4</sup></code></li>
34+
<li><code>0 &lt;= nums[i] &lt;= n</code></li>
35+
<li>All the numbers of <code>nums</code> are <strong>unique</strong>.</li>
36+
</ul>
37+
38+
<p>&nbsp;</p>
39+
<p><strong>Follow up:</strong> Could you implement a solution using only <code>O(1)</code> extra space complexity and <code>O(n)</code> runtime complexity?</p>

0 commit comments

Comments
 (0)