Loading...
Loading...
Loading...
A sorted list of ticket numbers may repeat. Remove the repeats in place using a read and a write pointer. Print the count of unique numbers on the first line and the unique numbers on the second line.
Example
Input
1 1 2 2 2 3 4 4
Output
4 1 2 3 4
Try the problem first. Open one hint at a time.
The first value is always kept, so write starts at 1.
Copy a value forward only when it differs from the last kept value, nums[write - 1].
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor