Problem 57 · Medium

Insert Interval

Insert a new interval into a sorted list of non-overlapping intervals and merge any overlaps. The visual keeps the intervals before the insertion, merges those touching the new one, and appends the rest.

Open the interactive visualisation