
Write a function that squeezes the duplicates out of an already sorted array in place and returns how many distinct values it kept.
int a[] = {1, 1, 2, 3, 3, 3}; unique_sorted(a, 6);3 | 1 2 3int a[] = {-4, -4, 0, 7}; unique_sorted(a, 4);3 | -4 0 7int a[] = {5, 5, 5, 5}; unique_sorted(a, 4);1 | 5int a[] = {42}; unique_sorted(a, 0);0 |unique_sorted.c<stddef.h>defines size_t
Run the tests to grade your code
Write a function that squeezes the duplicates out of an already sorted array in place and returns how many distinct values it kept.
int a[] = {1, 1, 2, 3, 3, 3}; unique_sorted(a, 6);3 | 1 2 3int a[] = {-4, -4, 0, 7}; unique_sorted(a, 4);3 | -4 0 7int a[] = {5, 5, 5, 5}; unique_sorted(a, 4);1 | 5int a[] = {42}; unique_sorted(a, 0);0 |unique_sorted.c<stddef.h>defines size_t
Run the tests to grade your code
Memory will appear here