Last active
November 14, 2018 00:36
-
-
Save Chillee/8c35dce0bd710fb35e6bd6f3bd98be90 to your computer and use it in GitHub Desktop.
Longest Increasing Subsequence(LIS)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vector<int> ans; | |
| for (auto x : A) { | |
| auto it = lower_bound(ans.begin(), ans.end(), x); | |
| if (it == ans.end()) | |
| ans.push_back(x); | |
| else | |
| *it = x; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment