Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Given a list of intervals:
- example: [
- {7, 9},
- {2, 4},
- {1, 3},
- {3, 5},
- {2, 5},
- {4, 6}
- ]
- write a function that merges overlapping intervals.
- example output/return: [
- {7, 9},
- {1, 6}
- ]
- */
- /*
- Interval => Span of time, with start and end
- the start time for a given interval is always less than or equal to the end time
- the start and end times are always positive integers
- |-------|
- |--------|
- |--------------| -> overlap
- |-------|
- |------|
- |--------------| -> overlap
- |-----|
- |------|
- |-----| |------| -> no overlap
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement