Python data engineering interview problem. Difficulty: beginner. Pattern: Hashing. About 10 minutes. Free to practice.
Return the sorted unique intersection of two lists. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement list_intersection(a: list, b: list) -> list returning sorted unique values present in both.
Input: list_intersection([1, 2, 2, 1], [2, 2]) Output: [2] Only 2 is shared.
Topics: lakebench, python, set, intersection.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Return the sorted unique intersection of two lists.
Implement `list_intersection(a: list, b: list) -> list` returning sorted unique values present in both. Example: `[1, 2, 2, 1], [2, 2]` → `[2]`. Keep the harness.