1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最小公共值 [minimum-common-value].html
2023-01-23 20:16:24 +08:00

30 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你两个整数数组&nbsp;<code>nums1</code>&nbsp;<code>nums2</code>&nbsp;,它们已经按非降序排序,请你返回两个数组的 <strong>最小公共整数</strong>&nbsp;。如果两个数组&nbsp;<code>nums1</code>&nbsp;<code>nums2</code>&nbsp;没有公共整数,请你返回&nbsp;<code>-1</code>&nbsp;</p>
<p>如果一个整数在两个数组中都 <strong>至少出现一次</strong>&nbsp;,那么这个整数是数组&nbsp;<code>nums1</code>&nbsp;<code>nums2</code>&nbsp;<strong>公共</strong>&nbsp;的。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>nums1 = [1,2,3], nums2 = [2,4]
<b>输出:</b>2
<b>解释:</b>两个数组的最小公共元素是 2 ,所以我们返回 2 。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>nums1 = [1,2,3,6], nums2 = [2,3,4,5]
<b>输出:</b>2
<b>解释:</b>两个数组中的公共元素是 2 和 3 2 是较小值,所以返回 2 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums1.length, nums2.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums1[i], nums2[j] &lt;= 10<sup>9</sup></code></li>
<li><code>nums1</code>&nbsp;<code>nums2</code>&nbsp;都是 <strong>非降序</strong>&nbsp;的。</li>
</ul>