Python data engineering interview problem. Difficulty: intermediate. Pattern: Intervals. About 14 minutes. Part of the Pro drill bank.
Insert a new interval into a sorted non-overlapping list and merge. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement insert_interval(intervals: list, new_interval: list) -> list.
Input: insert_interval([[1, 3], [6, 9]], [2, 5]) Output: [[1, 5], [6, 9]] New interval merges with [1,3].
Topics: lakebench, python, insert, merge.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Insert a new interval into a sorted non-overlapping list and merge.
Implement `insert_interval(intervals: list, new_interval: list) -> list`. Example: `[[1, 3], [6, 9]], [2, 5]` → `[[1, 5], [6, 9]]`. Keep the harness.