human
Smallest subarray whose product leaves remainder K when divided by size of the array | Function to find the subarray of minimum length.
Initialize the minimum subarray size to N + 1.
Generate all possible subarray.
Initialize the product.
Find the product.
Return the minimum size of subarray.
Driver code.
Given array"
How can the above be solved in Python?

Write me a code to smallest subarray whose product leaves remainder K when divided by size of the array and the other steps required?
assistant
#Here is code to smallest subarray whose product leaves remainder K when divided by size of the array and the other steps required.
 def findsubArray ( arr , N , K ) :
	res = N + 1
	for i in range ( 0 , N ) :
		curr_prad = 1
		for j in range ( i , N ) :
			curr_prad = curr_prad * arr [ j ]
			if ( curr_prad % N == K and res > ( j - i + 1 ) ) :
				res = min ( res , j - i + 1 )
				break
	if res == N + 1 :
		return 0
	else :
		return res
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 2 , 3 ]
	N = len ( arr )
	K = 1
	answer = findsubArray ( arr , N , K )
	if ( answer != 0 ) :
		print ( answer )
	else :
		print ( - 1 )