Python data engineering interview problem. Difficulty: beginner. Pattern: Arrays. About 10 minutes. Free to practice.
Keep first occurrence of each value and drop later duplicates. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement unique_preserve(nums: list) -> list returning unique values in first-seen order.
Input: unique_preserve([1, 2, 1, 3, 2]) Output: [1, 2, 3] Later 1 and 2 are dropped.
Topics: lakebench, python, dedupe, order.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Keep first occurrence of each value and drop later duplicates.
Implement `unique_preserve(nums: list) -> list` returning unique values in first-seen order. Example: `[1, 2, 1, 3, 2]` → `[1, 2, 3]`. Keep the harness.