mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
25 lines
691 B
HTML
25 lines
691 B
HTML
|
<p>输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s。如果有多对数字的和等于s,则输出任意一对即可。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre><strong>输入:</strong>nums = [2,7,11,15], target = 9
|
|||
|
<strong>输出:</strong>[2,7] 或者 [7,2]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 2:</strong></p>
|
|||
|
|
|||
|
<pre><strong>输入:</strong>nums = [10,26,30,31,47,60], target = 40
|
|||
|
<strong>输出:</strong>[10,30] 或者 [30,10]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>限制:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>1 <= nums.length <= 10^5</code></li>
|
|||
|
<li><code>1 <= nums[i] <= 10^6</code></li>
|
|||
|
</ul>
|