Remove Duplicates from a Sorted List In Place

easy
Checkpoint challenge
Solve this to show you know the material and jump straight to Unit 4. Everything before it counts as cleared.

Given a sorted list, remove duplicates in place so each value appears once, keeping order. Return the new length k; the first k elements of the list must be the unique values. Use O(1) extra space.

Then implement allow_two(nums): the same, but each value may appear at most twice.

#two-pointers#arrays2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Remove Duplicates from a Sorted List In Place · TechGradify