Insert Interval

Medium

📝 Description

Insert new interval into sorted list of non-overlapping intervals

Input Format

Existing intervals and new interval

Output Format

Merged intervals after insertion

Constraints

0 ≤ intervals.length ≤ 10^4

🔍 Sample Input

[[1,3],[6,9]]
[2,5]
            

✅ Sample Output

[[1,5],[6,9]]
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run