human
Length of longest subarray with increasing contiguous elements | Function to find the longest subarray with increasing contiguous elements.
Stores the length of required longest subarray.
Stores the length of length of longest such subarray from ith index.
If consecutive elements are increasing and differ by 1.
Otherwise.
Update the longest subarray obtained so far.
Return the length obtained.
Driver Code"
Solution in Python:
assistant
#Here is code to length of longest subarray with increasing contiguous elements and the other steps required.
 def maxiConsecutiveSubarray ( arr , N ) :
	maxi = 0 ;
	for i in range ( N - 1 ) :
		cnt = 1 ;
		for j in range ( i , N - 1 ) :
			if ( arr [ j + 1 ] == arr [ j ] + 1 ) :
				cnt += 1 ;
			else :
				break ;
		maxi = max ( maxi , cnt ) ;
		i = j ;
	return maxi ;
if __name__ == ' _ _ main _ _ ' :
	N = 11 ;
	arr = [ 1 , 3 , 4 , 2 , 3 , 4 , 2 , 3 , 5 , 6 , 7 ] ;
	print ( maxiConsecutiveSubarray ( arr , N ) ) ;