Data & Features ยท Easy
Deduplication
Remove duplicate identifiers while preserving their first-occurrence order.
Task
Implement deduplication(values: list[int]) -> list[int]. Remove duplicate integer identifiers while preserving the order of their first occurrences.
Requirements
- Return each distinct value exactly once.
- Keep the first occurrence of each value and discard all of its later occurrences.
- Preserve first-occurrence order; do not sort the result.
- Treat negative, zero, and positive integers as ordinary identifiers.
- Return an empty output for empty input.
- Do not mutate the input.
Example
deduplication([4, 2, 4, 1, 2, 3])
# [4, 2, 1, 3]