human
Count of binary strings of length N having equal count of 0 ' s ▁ and ▁ 1' s and count of 1 ' s ▁ â ‰ ¥ ▁ count ▁ of ▁ 0' s in each prefix substring | Function to calculate and returns the value of Binomial Coefficient C ( n , k ).
Since C ( n , k ) = C ( n , n - k ).
Calculate the value of [ n * ( n - 1 ) * -- - * ( n - k + 1 ) ] / [ k * ( k - 1 ) * -- - * 1 ].
Function to return the count of all binary strings having equal count of 0 ' s ▁ and ▁ 1' s and each prefix substring having frequency of 1 ' s ▁ > = ▁ frequencies ▁ of ▁ 0' s.
If N is odd.
No such strings possible.
Otherwise.
Calculate value of 2 nCn.
Return 2 nCn / ( n + 1 ).
Driver Code"
Solution in Python:
assistant
#Here is code to count of binary strings of length N having equal count of 0 ' s ▁ and ▁ 1' s and count of 1 ' s ▁ â ‰ ¥ ▁ count ▁ of ▁ 0' s in each prefix substring and the other steps required.
 def binomialCoeff ( n , k ) :
	res = 1
	if ( k > n - k ) :
		k = n - k
	for i in range ( k ) :
		res *= ( n - i )
		res //= ( i + 1 )
	return res
def countStrings ( N ) :
	if ( N % 2 == 1 ) :
		return 0
	else :
		N //= 2
		c = binomialCoeff ( 2 * N , N )
		return c // ( N + 1 )
if __name__ == ' _ _ main _ _ ' :
	N = 6
	print ( countStrings ( N ) )