Unique Integers in array that sum up to zero | Algorithms
Objective: Given an integer N, write a function to return an array containing N unique integers that sum up to zero. There are many possible arrays that sum upto 0 for any N, you need to return any one array. Example: N = 4 Output: [-1, 1, -2, 2] or [-1, -2, 3, 0] or [-2, -4, 5, 1] or any other such array that sum to 0.
Post to Tumblr