LeetCode --- 1304. Find N Unique Integers Sum up to Zero 解题报告

Posted 杨鑫newlfe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1304. Find N Unique Integers Sum up to Zero 解题报告相关的知识,希望对你有一定的参考价值。

Given an integer n, return any array containing n unique integers such that they add up to 0.

Example 1:

Input: n = 5
Output: [-7,-1,1,3,4]
Explanation: These arrays also are accepted [-5,-1,1,2,3] , [-3,-1,2,-2,4].

Example 2:

Input: n = 3
Output: [-1,0,1]

Example 3:

Input: n = 1
Output: [0]

Constraints:

  • 1 <= n <= 1000

所有代码均可在Github中找到:

下载链接

# -*- coding:utf-8 -*-
__author__ = \'yangxin\'
"""
Solutions:
题目的意思就是给定一个

以上是关于LeetCode --- 1304. Find N Unique Integers Sum up to Zero 解题报告的主要内容,如果未能解决你的问题,请参考以下文章

Leetcode1304. Find N Unique Integers Sum up to Zero

Leetcode 1304. Find N Unique Integers Sum up to Zero

1304. Find N Unique Integers Sum up to Zero

leetcode1304

Leetcode刷题100天—1304. 和为零的N个唯一整数(数学)—day47

Leetcode刷题100天—1304. 和为零的N个唯一整数(数学)—day47