human
Length of second longest sequence of consecutive 1 s in a binary array | ''Function to find maximum and second maximum length.
'' Initialise maximum length.
'' Initialise second maximum length.
'' Initialise count.
'' Iterate over the array.
'' If sequence ends.
'' Reset count.
'' Otherwise.
'' Increase length  of current sequence.
'' Update maximum.
'' Traverse the given array.
'' If sequence continues.
'' Increase length  of current sequence.
'' Update second max.
'' Reset count when 0 is found.
'' Print the result.
''Driver Code.
'' Given array.
'' Function Call"
Solution in Python:

What is a code to length of second longest sequence of consecutive 1 s in a binary array and the other steps required?
assistant
#Here is code to length of second longest sequence of consecutive 1 s in a binary array and the other steps required.
 def FindMax ( arr , N ) :
	maxi = - 1
	maxi2 = - 1
	count = 0
	for i in range ( N ) :
		if ( arr [ i ] == 0 ) :
			count = 0
		else :
			count += 1
			maxi = max ( maxi , count )
	for i in range ( N ) :
		if ( arr [ i ] == 1 ) :
			count += 1
			if ( count > maxi2 and count < maxi ) :
				maxi2 = count
		if ( arr [ i ] == 0 ) :
			count = 0
	maxi = max ( maxi , 0 )
	maxi2 = max ( maxi2 , 0 )
	print ( maxi2 )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 1 , 1 , 0 , 0 , 1 , 1 ]
	N = len ( arr )
	FindMax ( arr , N )