20%off off — LaunchSpecial
Exercises/#130 Insert Interval
#130

Insert Interval

Medium📦 Arrays
85 XP

Problem

Given a sorted list of non-overlapping intervals and a new interval, insert it and merge if necessary.

Examples

Input: intervals=[[1,3],[6,9]], newInterval=[2,5]
Output: [[1,5],[6,9]]

Input: intervals=[[1,2],[3,5],[6,7],[8,10]], newInterval=[4,8]
Output: [[1,2],[3,10]]
arrayintervalssorting
AI Assistant— powered by AI

Unlock hints progressively — start gentle, go deeper only if needed.

💡

Level 1: Gentle Nudge

A subtle direction

🗺️

Level 2: Approach

The algorithm to use

🔍

Level 3: Detailed

Step-by-step guidance

130 / 150

Your Solution

⚡ JavaScript
Loading...

to save progress and use AI features