Skip to content

Commit 130c3a0

Browse files
authored
Update video-stitching.cpp
1 parent 0786d96 commit 130c3a0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

C++/video-stitching.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ class Solution {
99
sort(clips.begin(), clips.end());
1010
for (const auto& clip : clips) {
1111
int left = clip[0], right = clip[1];
12-
if (reachable >= T || left > reachable) {
12+
if (left > reachable) {
1313
break;
1414
} else if (left > curr_reachable) {
1515
curr_reachable = reachable;
1616
++result;
1717
}
1818
reachable = max(reachable, right);
19+
if (reachable >= T) {
20+
return result;
21+
}
1922
}
20-
return (reachable >= T) ? result : -1;
23+
return -1;
2124
}
2225
};

0 commit comments

Comments
 (0)