// Given an array, eliminates duplicates in that array and returns the new size
int RemoveDuplicates(int* arr, int size)
{
std::sort(arr, arr+size);
for (int i = 0; i < size-1; i++)
{
if ( arr[i] == arr[i+1] )
{
for (int j = i+1; j < size-1; j++)
arr[j] = arr[j-1];
--size;
}
}
return size;
}