Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25db00e

Browse files
author
Victor
authored
Fixed a bug.
1 parent ce3335a commit 25db00e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎986. Interval List Intersections.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,18 @@ int** intervalIntersection(int** A, int ASize, int* AColSize, int** B, int BSize
7373
i = 0, j = 0;
7474
while (i < ASize && j < BSize) {
7575
a = A[i]; b = B[j];
76-
if (a[0] > b[1]) {
77-
j ++; continue;
78-
}
79-
if (b[0] > a[1]) {
80-
i ++; continue;
81-
}
8276
x = _max(a[0], b[0]);
8377
y = _min(a[1], b[1]);
78+
79+
if (x <= y) add2res(&res, x, y);
80+
8481
if (a[1] > b[1]) j ++;
8582
else i ++;
86-
add2res(&res, x, y);
8783
}
88-
**returnColumnSizes = res.c;
84+
85+
*returnColumnSizes = res.c;
8986
*returnSize = res.n;
87+
9088
return res.p;
9189
}
9290

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /