XOR all of the elements of the array. The duplicated elements cancel each other out, and the result is the unduplicated element.
Dave On Oct 21, 9:05 am, bittu <shashank7andr...@gmail.com> wrote: > You have an array consisting of 2n+1 elements, n elements in it are > married, i.e they occur twice in the array, however there is one > element which only appears once in the array. You need to find that > number in a single pass using constant memory,assuming that all are > positive numbers. > > Regards > Shashank Mani -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.