Skip to content

Commit 60ee0b4

Browse files
committed
Create README - LeetHub
1 parent 96f18ec commit 60ee0b4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<h2><a href="https://leetcode.com/problems/intersection-of-two-arrays-ii/">350. Intersection of Two Arrays II</a></h2><h3>Easy</h3><hr><div><p>Given two integer arrays <code>nums1</code> and <code>nums2</code>, return <em>an array of their intersection</em>. Each element in the result must appear as many times as it shows in both arrays and you may return the result in <strong>any order</strong>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong>Example 1:</strong></p>
5+
6+
<pre><strong>Input:</strong> nums1 = [1,2,2,1], nums2 = [2,2]
7+
<strong>Output:</strong> [2,2]
8+
</pre>
9+
10+
<p><strong>Example 2:</strong></p>
11+
12+
<pre><strong>Input:</strong> nums1 = [4,9,5], nums2 = [9,4,9,8,4]
13+
<strong>Output:</strong> [4,9]
14+
<strong>Explanation:</strong> [9,4] is also accepted.
15+
</pre>
16+
17+
<p>&nbsp;</p>
18+
<p><strong>Constraints:</strong></p>
19+
20+
<ul>
21+
<li><code>1 &lt;= nums1.length, nums2.length &lt;= 1000</code></li>
22+
<li><code>0 &lt;= nums1[i], nums2[i] &lt;= 1000</code></li>
23+
</ul>
24+
25+
<p>&nbsp;</p>
26+
<p><strong>Follow up:</strong></p>
27+
28+
<ul>
29+
<li>What if the given array is already sorted? How would you optimize your algorithm?</li>
30+
<li>What if <code>nums1</code>'s size is small compared to <code>nums2</code>'s size? Which algorithm is better?</li>
31+
<li>What if elements of <code>nums2</code> are stored on disk, and the memory is limited such that you cannot load all elements into the memory at once?</li>
32+
</ul>
33+
</div>

0 commit comments

Comments
 (0)