Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
LIS
//g++ 7.4.0 #include <bits/stdc++.h> using namespace std; int listfirst(int x); //int a[-1]={INT_MIN}; int a[11]={1,5,2,6,3,7,4,8,9,10,11}; int i=7; int j=5; int listfirst(int x) { int temp=0; for(int k=x+1;k<i;k++) { if(a[k] > a[x]) temp=max(temp,listfirst(k)); } if(temp==j) return temp; // temp+=1 ; return 1+temp; } int main() { int temp=0,x; // int j=4; for(x=0;x<i;x++) { // if(temp == j) // break; temp=max(temp,listfirst(x)); cout<<temp<<endl; } cout<<"LIS of length: "<<temp<<" at Index: "<<x; }
run
|
edit
|
history
|
help
0
ssss
Cours C++
pangram
Click 5
My Type - nicro
Interest Compounding
Bad palindrom
Microsoft - MaxEmployeeAttendence (R repititions - DP solution bitmask)
Bind Function
CPP - Ex 5