Created
July 19, 2013 17:44
-
-
Save aajjbb/6040996 to your computer and use it in GitHub Desktop.
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
struct LISNumberDivTwo { | |
int calculate(vector <int> seq) { | |
int i, j, ans = 0, N = seq.size(); | |
for (i = 0; i < N; i++) { | |
j = i + 1; | |
priority_queue<int> q; q.push(seq[i]); | |
while (j < N && seq[j] > q.top()) { | |
q.push(seq[j]); j += 1; | |
} | |
ans += 1; | |
i = j - 1; | |
} | |
return ans; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment