DIY: Merge Intervals

Problem statement

You are given a list of intervals in the form of start and end times. Your task is to merge as many intervals as possible. Two intervals can be merged if they are overlapping (one begins before the other ends) or adjacent (one starts exactly when the other ends). The output is the resultant list of intervals.

Input

...

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy