human
Count subarrays having an equal count of 0 s and 1 s segregated | ''Function to count subarrays having equal count of 0s and 1s with all 0s and all 1s grouped together.
'' Stores the count.
'' Initialize cur with first element.
'' If the next element is same  as the current element.
'' Increment count.
'' Update curr.
'' Iterate over the array count.
'' Consider the minimum.
.
''Given arr[].
''Function Call"
Solution in Python:
assistant
#Here is code to count subarrays having an equal count of 0 s and 1 s segregated and the other steps required.
 def countSubarrays ( A ) :
	res = 0
	curr , cnt = A [ 0 ] , [ 1 ]
	for c in A [ 1 : ] :
		if c == curr :
			cnt [ - 1 ] += 1
		else :
			curr = c
		cnt . append ( 1 )
	for i in range ( 1 , len ( cnt ) ) :
		res += min ( cnt [ i - 1 ] , cnt [ i ] )
	print ( res - 1 )
/ * Driver code * /
A = [ 1 , 1 , 0 , 0 , 1 , 0 ]
countSubarrays ( A )