Blind 75 Flashcards
1
Q
Merge a list of intervals
A
- Sort the start and end times of the intervals
2. Iterate based on end index; if start[i+1] > end[i], add [start[j], end[i]] and set j = i+1
Merge a list of intervals
2. Iterate based on end index; if start[i+1] > end[i], add [start[j], end[i]] and set j = i+1