size. Build a set of size pairwise distinct integers that add up to zero, keeping the largest absolute value in the set as small as possible.
It can be shown that such a set is unique. Return its numbers in any order.size=4 → [1, -1, 2, -2]
Four distinct numbers summing to zero fit in [-2, 2]: 1, -1, 2, -2. The range [-1, 1] holds only three integers, so it is not enough.
size=5 → [1, -1, 2, -2, 0]
With a bound of 2, all five integers from -2 to 2 are needed, zero included.
size=1 → [0]
size ≤ 1000size=4
[1, -1, 2, -2]
Run checks the first 3 tests in your browser. Submit checks all 63 tests on the server, hidden ones included.