@sarath:

it is not specified that the range is from 1 to n..it may look like this:
1 99 2 99

here you cant access a[99]..

On Fri, Sep 16, 2011 at 7:28 PM, sarath prasath <[email protected]>wrote:

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



-- 
*prasanth*

-- 
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