we can use hashtable ... and maintain count with each entry to the table.

if number occur for first time increment count..
if number occur again decrement count.

in the end jus check for entry whose count is 0....rest count >  0
one who is repeated twice will have count=0

On Thu, Nov 17, 2011 at 9:29 PM, himanshu kansal <
[email protected]> wrote:

> consider an array having n elements.....out of which one number is
> repeated twice....other number are repeated odd number of times(for
> simplicity, assume other numbers are occurring just once)....
>
> can you find the number that is repeated twice in O(n) time???
>
> PS: numbers are not from a particular range.....
>
> --
> 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