Register | Login

Problem: N/2 Unique and N/2 Duplicates

Posted by indian1 (#2) 583 days ago (Editorial)
An array of size n, has n/2 unique elements and n/2 occurences of an element. Find the non-unique element in linear time?

Who Voted for this Story


Comments


Written by indian1 (#2)
583 days ago
The point is for N/2 Duplicates the only possibilities when we have no consecutive dupicates exist are

1X2X3X

X1X2X3

So all we need to check is out of 3 consecutive elements whether we have a duplicate




Indian Social News and Links Network