1304. Find N Unique Integers Sum up to Zero

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1304

class Solution:
    def sumZero(self, n: int) -> List[int]:
        res = list(range(1, n))
        res.append(-sum(res))
        return res