this is one is the elegant solution i came across
if u got an element just go to the elements index and mark the value to its
negative...
say for eg:
if u got a[i]=9;
then go to a[9] and make it as
a[9]=-a[9];
then do like this for all the elements in the array
so now u can get the logic to how to find the element which is present
twice...


On Wed, Aug 31, 2011 at 11:32 AM, Navneet Gupta <[email protected]>wrote:

> You are given an array. One integer is in the array twice and others
> are unique. Find that no. O(n) Solution
>
> --
> Regards,
> Navneet
>
> --
> 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.

Reply via email to