Basic example
Input
unique_preserve([1, 2, 2, 3, 1])
Output
[1, 2, 3]
1 appears first, then 2, then 3. Subsequent duplicates are ignored.
Full lesson preview
Return the unique elements from a list while keeping their first-seen order.
Problem statement
Task
Examples
Input
unique_preserve([1, 2, 2, 3, 1])
Output
[1, 2, 3]
1 appears first, then 2, then 3. Subsequent duplicates are ignored.
Input format
Output format
Constraints
Samples
Input
unique_preserve([5, 5, 6, 7, 6])
Output
[5, 6, 7]
Keeps first 5, first 6, and first 7; ignores later duplicates.