← Questions
Distinct integers that match a count of positive pair sums
0
I was asked this
No reports yet. Sign in to say where you were asked it.
You are given n non-negative counts p[0..n-1]. Build n distinct integers a[0..n-1] such that no two of them (an element with itself included) add up to 0, and for every i, p[i] equals the number of indices j (j = i counts) with a[i] + a[j] > 0.
Among all valid answers, return one whose largest absolute value is as small as possible; return None when no such sequence exists. n can be up to 100,000.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
