human
Give me a code to maximize count of non and the other steps required given the following:
Maximize count of non | Function to count the maximum number of subarrays with sum K.
Stores all the distinct prefixSums obtained.
Stores the prefix sum of the current subarray.
Stores the count of subarrays with sum K.
If a subarray with sum K is already found.
Increase count.
Reset prefix sum.
Clear the set.
Insert the prefix sum.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to maximize count of non and the other steps required.
 def CtSubarr ( arr , N , K ) :
	st = set ( )
	prefixSum = 0
	st . add ( prefixSum )
	res = 0
	for i in range ( N ) :
		prefixSum += arr [ i ]
		if ( ( prefixSum - K ) in st ) :
			res += 1
			prefixSum = 0
			st . clear ( )
			st . add ( 0 )
		st . add ( prefixSum )
	return res
arr = [ - 2 , 6 , 6 , 3 , 5 , 4 , 1 , 2 , 8 ]
N = len ( arr )
K = 10
print ( CtSubarr ( arr , N , K ) )