mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
26 lines
815 B
HTML
26 lines
815 B
HTML
<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 be <strong>unique</strong> and you may return the result in <strong>any order</strong>.</p>
|
|
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> nums1 = [1,2,2,1], nums2 = [2,2]
|
|
<strong>Output:</strong> [2]
|
|
</pre>
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> nums1 = [4,9,5], nums2 = [9,4,9,8,4]
|
|
<strong>Output:</strong> [9,4]
|
|
<strong>Explanation:</strong> [4,9] is also accepted.
|
|
</pre>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= nums1.length, nums2.length <= 1000</code></li>
|
|
<li><code>0 <= nums1[i], nums2[i] <= 1000</code></li>
|
|
</ul>
|