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 5552e51 commit 127582fCopy full SHA for 127582f
DP/Maximum_increasing_subsequence_length.py
@@ -0,0 +1,8 @@
1
+def lis(arr,n):
2
+ lis = [1]*n
3
+ for i in range(1,n):
4
+ for j in range(0,i):
5
+ if arr[j]<arr[i]:lis[i] = max(lis[i],lis[j]+1) # we are thinking that upto j the length of the subseq. is lis[j] and we are doing +1
6
+ print("")
7
+ return max(lis)
8
+print(lis([10, 22, 9, 33, 21, 50, 41, 60, 80],9))
0 commit comments