Hi,

Hope someone can give the simplest solution , and maybe it can be in O(n) if it is possible with explanations.

I need a function that takes sorted int array , and a size , and returns a new compact array after removing the duplicated elements , and the new size.


It can be solved in O(n^2) also .

Example:

1 , 3, 7, 7, 8, 9, 9, 9, 10

and it will return :
1 , 3 , 7 , 8, 9, 10 and size 5

Thank you