Insert Interval
Updated Feb 24, 2026
Problem
Insert a new interval and merge if necessary.
Constraints
0 <= intervals.length <= 10^4
Examples
Example 1
Input:
{"intervals": [[1, 3], [6, 9]], "newInterval": [2, 5]}
Output:
[[1, 5], [6, 9]]
Function Signature
def insert(self, intervals: list[list[int]], newInterval: list[int]) -> list[list[int]]
How to Submit
Implement a Solution class with a insert method.
Your method will be called with the input parameters and should return the answer.