Loading...
Loading...
Loading...
A cleanup job must remove every occurrence of a target value from a list in place. Print how many items remain, followed by those items, all on one line.
Example
Input
5 3 2 2 3 4 3
Output
3 2 2 4
Two 3s are removed.
Try the problem first. Open one hint at a time.
Keep a write index for the next kept item.
Copy an item forward only when it differs from the target.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor