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 7b67b3c commit 864a634Copy full SHA for 864a634
my_try.cpp
@@ -0,0 +1,37 @@
1
+#include <bits/stdc++.h>
2
+using namespace std;
3
+
4
5
+int main()
6
+{
7
+ int left[1001], right[1001];
8
9
+ left[0] = 1;
10
+ for(int i = 1 ; i < n ; i++){
11
+ int mx = 1;
12
+ for(int j = 0; j <i; j++){
13
+ if(a[i]>a[j]){
14
+ mx = max(mx, left[j]+1);
15
+ }
16
17
+ left[i] = mx;
18
19
20
21
+ right[n-1] = 1;
22
+ for(int i=n-2 ; i>=0 ; i--)
23
+ {
24
25
+ for(int j = i+1 ; j<n; j++)
26
27
28
+ mx = max(mx , right[j]+1);
29
+ cout<<mx<< " ";
30
31
32
33
34
+ cout<<endl;
35
36
37
+}
0 commit comments