Python data engineering interview problem. Difficulty: beginner. Pattern: Two Pointers. About 10 minutes. Free to practice.
Merge two sorted lists in linear time without calling sort. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement merge_sorted(a: list, b: list) -> list merging two ascending sorted lists. Do not use sort() or sorted(). Target O(n+m).
Input: merge_sorted([1, 3, 5], [2, 4, 6]) Output: [1, 2, 3, 4, 5, 6] Pointers advance through both sides.
Topics: lakebench, python, merge.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Merge two sorted lists in linear time without calling sort.
Implement `merge_sorted(a: list, b: list) -> list` merging two ascending sorted lists. Do **not** use `sort()` or `sorted()`. Target O(n+m). Keep the harness.