given an array, all the elements in the array appear twince, only one element appears only once. Find that element. Eg, the array is 2 4 2 3 4 1 3 6 6, 1 should be the answer.
Sigiloso
ask what the largest possible value held in the array would be in this example, looks like 10 so let's go with that. int findDup( int a[], int n ){ // n is size of input array int temp[10] = { 0 }; for (int i = 0; i < n ; i++){ temp[a[i]] ++; } for ( i = 0; i < 10; i++) { if (temp[i] == 1) return i; } } syntax might be a bit off.. s'been a while since i programmed in c++ @_@