Fundamentals
/
Unique Integers That Sum Up To 0
⏸
00:00
↻
← Prev
Next →
▶
Question
Given an integer n, return any array containing n unique integers such that they add up to 0.
Example 1
Input
5
Output
[-4,-2,0,2,4]
Example 2:
Input
3
Output
[-2, 0, 2]
Example 3:
Input
1
Output
[0]
▶
My Code
▶
Reference Solution