Re: [algogeeks] Pairwise Sum Array

2011-02-26 Thread Ashim Kapoor
I think the output is wrong. It should be 1 3 4 9 n in no call them ai's a[1] to a[n] 4 5 10 7 12 13 m in no call them bi's b[1] to b[m] I assume starting from 1 to make manipulation easier n(n-1)/2= m n(n-1)=2m n2 -n -2m=0 using quadratic formula:- n=1 + sqrt( 1+8m)/2 This will always be a

Re: [algogeeks] Pairwise Sum Array

2011-02-26 Thread Ashim Kapoor
That is exactly what my solution is doing. On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal ashish.cooldude...@gmail.com wrote: There must be another good solution..please let me know . Thanks On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal ashish.cooldude...@gmail.com wrote: I think..

Re: [algogeeks] Pairwise Sum Array

2011-02-24 Thread ashish agarwal
I think.. As like no are a,b,c,d,e so sum will be a+b,a+c,a+d,a+e,b+c,b+d,b+e,c+d,c+e,d+e; so maximuum value will be d+e which is last element of array given take last three value 1.c+d 2.c+e 3.d+e eq(1)-eq(2)=d-e; solving it with 3rd eq will give d and e and with these value we can get other

Re: [algogeeks] Pairwise Sum Array

2011-02-24 Thread ashish agarwal
There must be another good solution..please let me know . Thanks On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal ashish.cooldude...@gmail.com wrote: I think.. As like no are a,b,c,d,e so sum will be a+b,a+c,a+d,a+e,b+c,b+d,b+e,c+d,c+e,d+e; so maximuum value will be d+e which is last

Re: [algogeeks] Pairwise Sum Array

2011-02-24 Thread saurabh agrawal
Last three values could be: 1.b+e 2.c+e 3.d+e On Thu, Feb 24, 2011 at 5:09 PM, ashish agarwal ashish.cooldude...@gmail.com wrote: I think.. As like no are a,b,c,d,e so sum will be a+b,a+c,a+d,a+e,b+c,b+d,b+e,c+d,c+e,d+e; so maximuum value will be d+e which is last element of array given

[algogeeks] Pairwise Sum Array

2011-02-23 Thread bittu
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 Thanks Regards Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] Pairwise Sum Array

2011-02-23 Thread radha krishnan
This s a topcoder problem :) On Wed, Feb 23, 2011 at 7:16 PM, bittu shashank7andr...@gmail.com wrote: 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 Thanks

[algogeeks] pairwise sum

2011-01-20 Thread snehal jain
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 4 5 7 10 12 13 o/p: 1 3 4 9 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this