Given an array of n elements which contains elements from 0 to n-1, with any of these numbers appearing any number of times. Find these repeating numbers in O(n) and using only constant memory space.
This was my code
But the problem is that if i have an element in an array which repeaats itself more than twice then its printing ,it more than once
eg … I/P => 1 2 2 3 4 (output - 2)
i/p=> 1 2 2 2 4( output 2 2) which is wrong
what should i do to solve this problem inO(N) and O(1) space ? If i have more an element appearing more than twice