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)/三数之和 [1fGaJU].html

38 lines
1.1 KiB
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>给定一个包含 <code>n</code> 个整数的数组&nbsp;<code>nums</code>,判断&nbsp;<code>nums</code>&nbsp;中是否存在三个元素&nbsp;<code>a</code> <code>b</code> <code>c</code> <em></em>使得&nbsp;<code>a + b + c = 0</code> ?请找出所有和为 <code>0</code>&nbsp;<strong>不重复&nbsp;</strong>的三元组。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [-1,0,1,2,-1,-4]
<strong>输出:</strong>[[-1,-1,2],[-1,0,1]]
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = []
<strong>输出:</strong>[]
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>nums = [0]
<strong>输出:</strong>[]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= nums.length &lt;= 3000</code></li>
<li><code>-10<sup>5</sup> &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
</ul>
<p>&nbsp;</p>
<p><meta charset="UTF-8" />注意:本题与主站 15&nbsp;题相同:<a href="https://leetcode-cn.com/problems/3sum/">https://leetcode-cn.com/problems/3sum/</a></p>