mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
36 lines
1.2 KiB
HTML
36 lines
1.2 KiB
HTML
<p>给你一个由 <code>n</code> 个整数组成的数组 <code>nums</code> ,和一个目标值 <code>target</code> 。请你找出并返回满足下述全部条件且<strong>不重复</strong>的四元组 <code>[nums[a], nums[b], nums[c], nums[d]]</code> (若两个四元组元素一一对应,则认为两个四元组重复):</p>
|
||
|
||
<ul>
|
||
<li><code>0 <= a, b, c, d < n</code></li>
|
||
<li><code>a</code>、<code>b</code>、<code>c</code> 和 <code>d</code> <strong>互不相同</strong></li>
|
||
<li><code>nums[a] + nums[b] + nums[c] + nums[d] == target</code></li>
|
||
</ul>
|
||
|
||
<p>你可以按 <strong>任意顺序</strong> 返回答案 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [1,0,-1,0,-2,2], target = 0
|
||
<strong>输出:</strong>[[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [2,2,2,2,2], target = 8
|
||
<strong>输出:</strong>[[2,2,2,2]]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= nums.length <= 200</code></li>
|
||
<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>
|
||
<li><code>-10<sup>9</sup> <= target <= 10<sup>9</sup></code></li>
|
||
</ul>
|