## Wednesday, December 14, 2011

### If pairwise sums of 'n' numbers are given in non-decreasing order identify the individual numbers. If the sum is corrupted print -1 Example: i/p: 4 5 7 10 12 13 o/p: 1 3 4 9

Labels:Data
Amazon Interview

Reactions: |

Subscribe to:
Post Comments
(
Atom
)

## 5 comments :

Shouldn't there be only a single "4" in the input? Four numbers should generate 6 pairwise sums, not 7.

@Ted Hoop , Yeah by mistake it was multiple 4's , thnx i have updated the same., it can done in O(N^2) , i am wondering for linear algo ?

Can you explain how did you do it in O(n^2) .

where n is the number of elements given to us. that is n = (N*(N-1)/2).

where N is the number of elements in final answer.

Please verify its correctness.

I'm not able to see the post. Only comments are visible.

Hey,

Am not able to see the program. only the question and comments are visible. I have visited this site in the past and I dint have any issues that time

- Chris

Post a Comment