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 = 5Output
[-7,-1,1,3,4]The returned array contains 5 unique integers whose sum is 0; other valid arrays are also accepted.
Example 2
Input
n = 3Output
[-1,0,1]The array contains 3 unique integers and -1 + 0 + 1 = 0.
Constraints
- 1 <= n <= 1000