+ 2
There is an array which consists of n integers . we have to delete items which are equal . First equal item is declared .
for example : int Parray [6] = {1 , 2 , 1 , 1, 5 , 6}; result is { 1 , 2 , 5 , 6 } ( I'm sorry if it's complicated , my English isn't so good )
1 Antwort
+ 3
void unify(int arr[], int& size)
{
set<int> s;
for(int i=0;i<size;i++) s.insert(arr[i]);
size=s.size();
copy(arr,arr+size,s.begin());
}
That removes any duplicates inside your array.