human
Number of subarrays having product less than K | Python3 program to count subarrays having product less than k ..
Counter for single element.
Multiple subarray.
If this multiple is less than k , then increment.
Driver Code"
Solution in Python:
 What is a code to number of subarrays having product less than K and the other steps required?
assistant
#Here is code to number of subarrays having product less than K and the other steps required.
 def countsubarray ( array , n , k ) :
	count = 0
	for i in range ( 0 , n ) :
		if array [ i ] < k :
			count += 1
		mul = array [ i ]
		for j in range ( i + 1 , n ) :
			mul = mul * array [ j ]
			if mul < k :
				count += 1
			else :
				break
	return count
array = [ 1 , 2 , 3 , 4 ]
k = 10
size = len ( array )
count = countsubarray ( array , size , k )
print ( count , end = " ▁ " )