Size of an array is n.All elements in the array are distinct in the range of [0 , n-1] except two elements.Find out repeated element without using extra temporary array with con
O(n) without the temp array.
a[]={1,0,0,2,3}; i=0; int required; while(i= 2 * n) required = a[i] % n; } print required;
(Assuming of course that n < MAX_INT - 2n)