Use a two-step process. First, check for a repeated number in the
first 4 elements. If none is found, then there are at least n/2-1
occurrences of the repeated elements in the last n-3 elements, meaning
that there must be at least two repeated elements in adjacent
positions. So second, check for equal adjacent numbers in the last n-3
elements.

Dave

On Aug 5, 8:36 am, AlgoBoy <manjunath.n...@gmail.com> wrote:
> an array in which n/2 elements are unique...and the remaning n/2 have
> the same elements but reapeated n/2 times. can anyone suggest a linear
> solution with constant space/...

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

Reply via email to