← ALL NOTES
Array

1304. Find N Unique Integers Sum up to Zero

Return any n distinct integers summing to zero. The construction is immediate: pairs of opposites (k, -k) cancel, so -n/2 … -1 and 1 … n/2 covers even n, and for odd n a lone 0 fills the middle…

Loading…