1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/和为s的两个数字 [he-wei-sde-liang-ge-shu-zi-lcof].html

25 lines
691 B
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>输入一个递增排序的数组和一个数字s在数组中查找两个数使得它们的和正好是s。如果有多对数字的和等于s则输出任意一对即可。</p>
<p>&nbsp;</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>&nbsp;</p>
<p><strong>限制:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 10^5</code></li>
<li><code>1 &lt;= nums[i]&nbsp;&lt;= 10^6</code></li>
</ul>