Rishab7
New Member
- Joined
- Apr 17, 2023
- Messages
- 21
- Thread Author
- #1
Hello all,
I am having issues understanding the code posted on this blog for the Longest Increasing Subsequence problem. I've been trying to implement the code, but I haven't been able to get the correct output. The code I've been trying to implement is as follows:
	
	
	
		
I've tried to debug it, but I'm still having issues. Can someone please help me understand what I'm doing wrong?
Thank you!
				
			I am having issues understanding the code posted on this blog for the Longest Increasing Subsequence problem. I've been trying to implement the code, but I haven't been able to get the correct output. The code I've been trying to implement is as follows:
		Code:
	
	def LIS(A):
    n = len(A)
    lis = [1]*n
    for i in range (1 , n):
        for j in range(0 , i):
            if A[i] > A[j] and lis[i]< lis[j] + 1 :
                lis[i] = lis[j]+1
    maximum = 0
    for i in range(n):
        maximum = max(maximum , lis[i])
    return maximumI've tried to debug it, but I'm still having issues. Can someone please help me understand what I'm doing wrong?
Thank you!
			
				Last edited by a moderator: 
			
		
	
								
								
									
    
								
							
							 
 
		 
 
		