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)/和为零的 N 个不同整数 [find-n-unique-integers-sum-up-to-zero].html

31 lines
809 B
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p>给你一个整数&nbsp;<code>n</code>,请你返回 <strong>任意&nbsp;</strong>一个由 <code>n</code>&nbsp;<strong>各不相同&nbsp;</strong>的整数组成的数组,并且这 <code>n</code> 个数相加和为 <code>0</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>n = 5
<strong>输出:</strong>[-7,-1,1,3,4]
<strong>解释:</strong>这些数组也是正确的 [-5,-1,1,2,3][-3,-1,2,-2,4]。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>n = 3
<strong>输出:</strong>[-1,0,1]
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>n = 1
<strong>输出:</strong>[0]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 1000</code></li>
</ul>