human
Count N | Function to count binary strings of length N having substring "11".
Initialize dp [ ] of size N + 1.
Base Cases.
Stores the first N powers of 2.
Generate.
Iterate over the range [ 2 , N ].
Prtotal count of substrings.
Driver Code"
Solution in Python:
assistant
#Here is code to count N and the other steps required.
 def binaryStrings ( N ) :
	dp = [ 0 ] * ( N + 1 )
	dp [ 0 ] = 0
	dp [ 1 ] = 0
	power = [ 0 ] * ( N + 1 )
	power [ 0 ] = 1
	for i in range ( 1 , N + 1 ) :
		power [ i ] = 2 * power [ i - 1 ]
	for i in range ( 2 , N + 1 ) :
		dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ] + power [ i - 2 ]
	print ( dp [ N ] )
if __name__ == ' _ _ main _ _ ' :
	N = 12
	binaryStrings ( N )