Glossary: Coding Interviews in JavaScript
Merge intervals
Also written: mergeSlots
Pattern 13: sort the intervals by start, then join each one to the last when its start is at most the last end. It costs O(n log n).
Glossary: Coding Interviews in JavaScript
Also written: mergeSlots
Pattern 13: sort the intervals by start, then join each one to the last when its start is at most the last end. It costs O(n log n).