All challenges
mediumarrays 10 XP per passing test

Remove Duplicates from a Sorted Array

Problem

Given a sorted array, remove duplicates from it. The array is sorted in ascending order. You can modify the input array in-place. The function should return the length of the modified array. For example, if the input array is [1, 1, 2, 3, 3, 3, 4, 5, 5], the function should return 5 and the modified array should be [1, 2, 3, 4, 5].
(run your code to see output)
Advertisement
Sponsored