Write a function `uniq` that takes a pointer to a dynamic array of ints, and the size of the array. The function needs to move all the unique elements to the beginning of the array, and return the...

Write a function `uniq` that takes a pointer to a dynamic array of ints, and the size of the array. The function needs to move all the unique elements to the beginning of the array, and return the count of the unique elements.
























input:int *arr = new int[6] {5, 3, 7, 5, 3, 6};
3int uniq_count = uniq(arr, 6);
4
5ASSERT_EQ(arr[0], 3);
6ASSERT_EQ(arr[3], 7);
7ASSERT_EQ(uniq_count, 4);


Nov 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here