human
Largest increasing subsequence of consecutive integers | Python3 implementation of longest continuous increasing subsequence Function for LIS.
Initialize result.
iterate through array and find end index of LIS and its Size.
print LIS size.
print LIS after setting start element.
Driver Code"
Solution in Python:
 Write me a code to largest increasing subsequence of consecutive integers and the other steps required?
assistant
#Here is code to largest increasing subsequence of consecutive integers and the other steps required.
 def findLIS ( A , n ) :
	hash = dict ( )
	LIS_size , LIS_index = 1 , 0
	hash [ A [ 0 ] ] = 1
	for i in range ( 1 , n ) :
		if A [ i ] - 1 not in hash :
			hash [ A [ i ] - 1 ] = 0
		hash [ A [ i ] ] = hash [ A [ i ] - 1 ] + 1
		if LIS_size < hash [ A [ i ] ] :
			LIS_size = hash [ A [ i ] ]
			LIS_index = A [ i ]
	print ( " LIS _ size ▁ = " , LIS_size )
	print ( " LIS ▁ : ▁ " , end = " " )
	start = LIS_index - LIS_size + 1
	while start <= LIS_index :
		print ( start , end = " ▁ " )
		start += 1
if __name__ == " _ _ main _ _ " :
	A = [ 2 , 5 , 3 , 7 , 4 , 8 , 5 , 13 , 6 ]
	n = len ( A )
	findLIS ( A , n )