Skip to content

Commit ba13f88

Browse files
committed
Update longest-increasing-subsequence.cpp
1 parent 036f11a commit ba13f88

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

C++/longest-increasing-subsequence.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class Solution {
2020
auto it = lower_bound(LIS->begin(), LIS->end(), target);
2121

2222
// If not found, append the target.
23-
if (it != LIS->end()) {
24-
*it = target;
25-
} else {
23+
if (it == LIS->end()) {
2624
LIS->emplace_back(target);
25+
} else {
26+
*it = target;
2727
}
2828
}
2929
};

0 commit comments

Comments
 (0)