Skip to content

Commit 46a14fe

Browse files
wogha95DaleSeo
andauthored
Update insert-interval/wogha95.js
Co-authored-by: Dale Seo <[email protected]>
1 parent 11bd72a commit 46a14fe

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

insert-interval/wogha95.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@ var insert = function (intervals, newInterval) {
3030
let overLappingEndIndex = 0;
3131
for (let index = 0; index < intervals.length; index++) {
3232
const interval = intervals[index];
33-
if (
34-
(interval[0] <= newInterval[0] && newInterval[0] <= interval[1]) ||
35-
newInterval[0] < interval[0]
36-
) {
33+
if (newInterval[0] <= interval[1]) {
3734
overLappingStartIndex = Math.min(overLappingStartIndex, index);
3835
}
39-
if (
40-
(interval[0] <= newInterval[1] && newInterval[1] <= interval[1]) ||
41-
interval[1] < newInterval[1]
42-
) {
36+
if (interval[0] <= newInterval[1]) {
4337
overLappingEndIndex = Math.max(overLappingEndIndex, index);
4438
}
4539
}

0 commit comments

Comments
 (0)