1 class Solution:
 2     def sumZero(self, n: int) -> List[int]:
 3         res = []
 4         k = n // 2
 5         i = 1
 6         for j in range(k):
 7             res.append(i)
 8             res.append(i * (-1))
 9             i += 1
10         if n % 2 == 1:
11             res.append(0)
12         return res

 

posted on 2019-12-29 11:16  Sempron2800+  阅读(129)  评论(0编辑  收藏  举报