Remove Duplicates from a Sorted List In Place

easy
Unit 3 · Arrays & Two Pointers0/3 to milestone

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