Problem intuition
- Because duplicates are adjacent in a sorted array, you only need to track the next slot for a new unique value.
- A non-optimal solution can still be correct by writing into a helper structure first, but the clean version reuses the array in place.