Loading...
Loading...
Loading...
A list of customer ids is sorted, with some ids repeated. Keep one copy of each id, in place. Print how many ids remain, followed by those ids, on one line.
Example
Input
8 1 1 2 2 2 3 5 5
Output
4 1 2 3 5
Four distinct ids.
Try the problem first. Open one hint at a time.
Because the list is sorted, equal ids sit side by side.
Compare each id with the last id you kept.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor