Coding

Merge a New Interval

Merge a new interval into a list of non-overlapping intervals.

Input: intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]

Output: [[1,2],[3,10],[12,16]]

Explanation: The new interval overlaps with [3,5], [6,7], and [8,10], merging them all into the unified block [3,10].

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

No answers yet

Be the first to share your approach to this question

Practice More Questions