We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d871d11 commit 32fef6cCopy full SHA for 32fef6c
Solutions/[12]_3.cpp
@@ -0,0 +1,26 @@
1
+#include <bits/stdc++.h>
2
+
3
+using namespace std;
4
5
+int n, result;
6
+vector<int> data;
7
+int dp[1000];
8
9
+int main() {
10
+ cin >> n;
11
+ for (int i = 0; i < n; i++) {
12
+ int x;
13
+ cin >> x;
14
+ data.push_back(x);
15
+ }
16
17
+ dp[i] = 1;
18
+ for (int j = 0; j < i; j++) {
19
+ if (data[j] < data[i]) {
20
+ dp[i] = max(dp[i], dp[j] + 1);
21
22
23
+ result = max(result, dp[i]);
24
25
+ cout << result;
26
+}
0 commit comments