Skip to content

Commit e79d6bd

Browse files
committed
Create README - LeetHub
1 parent 1817176 commit e79d6bd

File tree

1 file changed

+25
-0
lines changed
  • 0442-find-all-duplicates-in-an-array

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<h2><a href="https://leetcode.com/problems/find-all-duplicates-in-an-array/">442. Find All Duplicates in an Array</a></h2><h3>Medium</h3><hr><div><p>Given an integer array <code>nums</code> of length <code>n</code> where all the integers of <code>nums</code> are in the range <code>[1, n]</code> and each integer appears <strong>once</strong> or <strong>twice</strong>, return <em>an array of all the integers that appears <strong>twice</strong></em>.</p>
2+
3+
<p>You must write an algorithm that runs in&nbsp;<code>O(n)&nbsp;</code>time and uses only constant extra space.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
<pre><strong>Input:</strong> nums = [4,3,2,7,8,2,3,1]
8+
<strong>Output:</strong> [2,3]
9+
</pre><p><strong class="example">Example 2:</strong></p>
10+
<pre><strong>Input:</strong> nums = [1,1,2]
11+
<strong>Output:</strong> [1]
12+
</pre><p><strong class="example">Example 3:</strong></p>
13+
<pre><strong>Input:</strong> nums = [1]
14+
<strong>Output:</strong> []
15+
</pre>
16+
<p>&nbsp;</p>
17+
<p><strong>Constraints:</strong></p>
18+
19+
<ul>
20+
<li><code>n == nums.length</code></li>
21+
<li><code>1 &lt;= n &lt;= 10<sup>5</sup></code></li>
22+
<li><code>1 &lt;= nums[i] &lt;= n</code></li>
23+
<li>Each element in <code>nums</code> appears <strong>once</strong> or <strong>twice</strong>.</li>
24+
</ul>
25+
</div>

0 commit comments

Comments
 (0)