human
Longest subarray in which all elements are smaller than K | Function to find the length of the longest subarray with all elements smaller than K.
Stores the length of maximum consecutive sequence.
Stores maximum length of subarray.
Iterate through the array.
Check if array element smaller than K.
Store the maximum of length and count.
Reset the counter.
Print the maximum length.
Driver Code.
Given array arr [ ].
Size of the array.
Given K.
Function Call"
Solution in Python:
 Can you provide a code to longest subarray in which all elements are smaller than K and the other steps required?
assistant
#Here is code to longest subarray in which all elements are smaller than K and the other steps required.
 def largestSubarray ( arr , N , K ) :
	count = 0
	length = 0
	for i in range ( N ) :
	if ( arr [ i ] < K ) :
		count += 1
	else :
		length = max ( length , count )
		count = 0
	if ( count ) :
		length = max ( length , count )
	print ( length , end = " " )
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 8 , 3 , 5 , 2 , 2 , 1 , 13 ]
	N = len ( arr )
	K = 6
	largestSubarray ( arr , N , K )