Hi folks,
I just thought since the range of the numbers is not known so can go
this way;
1.We can find the max number in the array in o(n)=MAX say
2.Then (MAX(MAX+1))/2-sum(a[1....n]) of given
array=S=(a1+a2+.........+an)-R
3. MAX!/prod(a[1...n])=P=(a1*a2*..........*an)/R
where a1,a2......an are the nos apart from nos in the array execpt the
repeated number R from 1........MAX
4.AM>=GM we know this.......
(a1+a2+....an)/n >= pow((a1*a2*.....an),1/n)
=> k1+R/n >= pow((k2*R),1/n)
I think computer is good enough to find R ...........
Please correct me if i am wrong
cheers
JAGANNATH
On Sat, Aug 20, 2011 at 5:12 PM, aditya kumar
<[email protected]>wrote:
> instead of that find sum of first n natural number sum ie (n(n+1))/2.;say
> NSum
> then find the sum of all elements of the array . say ASum
> ASUm - NSum = result (no repeated twice).
>
>
> On Fri, Aug 19, 2011 at 7:30 PM, Sanjay Rajpal
> <[email protected]>wrote:
>
>> :)
>>
>>
>> *Regards
>>
>> Sanju
>>
>> Happy to Help :)*
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.