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)/三数之和 [3sum].html
2022-03-29 12:43:11 +08:00

36 lines
906 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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>给你一个包含 <code>n</code> 个整数的数组 <code>nums</code>,判断 <code>nums</code> 中是否存在三个元素 <em>abc </em>使得 <em>a + b + c = </em>0 ?请你找出所有和为 <code>0</code> 且不重复的三元组。</p>
<p><strong>注意:</strong>答案中不可以包含重复的三元组。</p>
<p> </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> </p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 <= nums.length <= 3000</code></li>
<li><code>-10<sup>5</sup> <= nums[i] <= 10<sup>5</sup></code></li>
</ul>