Given a sorted array of integers, remove duplicates in-place.
Algorithm
Initialize a pointer for the last unique element.
Iterate through the array:
If the current element is greater than the last unique element, update the last unique element pointer.
If the current element is less than the last unique element but greater than the second last unique element, update the second last unique element pointer.
Return or print the values.
Time Complexity
The time complexity of this algorithm is O(n), where n is the number of elements in the array.