Objective
Write a function that squeezes the duplicates out of an already sorted array in place and returns how many distinct values it kept.
Steps
$ int a[] = {1, 1, 2, 3, 3, 3}; unique_sorted(a, 6);
3 | 1 2 3
$ int a[] = {-4, -4, 0, 7}; unique_sorted(a, 4);
3 | -4 0 7
$ int a[] = {5, 5, 5, 5}; unique_sorted(a, 4);
1 | 5
$ int a[] = {42}; unique_sorted(a, 0);
0 |
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Objective
Write a function that squeezes the duplicates out of an already sorted array in place and returns how many distinct values it kept.
Steps
$ int a[] = {1, 1, 2, 3, 3, 3}; unique_sorted(a, 6);
3 | 1 2 3
$ int a[] = {-4, -4, 0, 7}; unique_sorted(a, 4);
3 | -4 0 7
$ int a[] = {5, 5, 5, 5}; unique_sorted(a, 4);
1 | 5
$ int a[] = {42}; unique_sorted(a, 0);
0 |
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Tests
Run the tests to grade your code