Find N Unique Integers Sum up to Zero LeetCode solution in Python

1
class Solution:
2
def sumZero(self, n: int) -> List[int]:
3
q, p = divmod(n, 2)
4
if p:
5
return list(range(-q, q + 1))
6
else:
7
return list(range(-q, 0)) + list(range(1, q + 1))

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0