Skip to content

Instantly share code, notes, and snippets.

@aajjbb
Created July 19, 2013 17:44
Show Gist options
  • Save aajjbb/6040996 to your computer and use it in GitHub Desktop.
Save aajjbb/6040996 to your computer and use it in GitHub Desktop.
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