Skip to content

Commit 82194fc

Browse files
author
Joseph Luce
authored
Update 056_merge_intervals.md
1 parent 6af8c54 commit 82194fc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

leetcode/medium/056_merge_intervals.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
By sorting the intervals, we can then recreate the result by comparing previous intervals with the current interval from left to right.
99
In this way, we can check if the two intervals overlap each other after the sort.
10+
We can keep a temporary new interval that we compare to as we loop.
11+
When finding a non-overlapping interval, we can insert the new interval into the result and set the new interval as the current interval.
1012

1113
```
1214
class Solution:

0 commit comments

Comments
 (0)