Skip to content

Commit 127582f

Browse files
committed
Maximum Increasing Subset
1 parent 5552e51 commit 127582f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)