blob: a4936ff272a1aef5242f7cf0da0c1dd776e71a35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# 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.
"""
class Solution(object):
def sumZero(self, n):
"""
:type n: int
:rtype: List[int]
"""
return range(1 - n, n, 2)
if __name__ == "__main__":
obj = Solution()
print(obj.sumZero(5))
print(obj.sumZero(3))
print(obj.sumZero(1))
|