About Me

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


5 comments:

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

    ReplyDelete
  2. @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 ?

    ReplyDelete
  3. 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.

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

    ReplyDelete
  5. 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

    ReplyDelete

Hi thanks , we will get back to you shortly !!!