human
Write me a code to count ways to tile an N and the other steps required given the following:
Count ways to tile an N | Function to count the ways to tile N * 1 board using 1 * 1 and 2 * 1 tiles.
dp [ i ] : Stores count of ways to tile i * 1 board using given tiles.
Base Case.
Iterate over the range [ 2 , N ].
Fill dp [ i ] using the recurrence relation.
Driver Code.
Given N.
Function Call"
Solution in Python:
assistant
#Here is code to count ways to tile an N and the other steps required.
 def countWaysToTileBoard ( N ) :
	dp = [ 0 ] * ( N + 1 )
	dp [ 0 ] = 1
	dp [ 1 ] = 2
	for i in range ( 2 , N + 1 ) :
		dp [ i ] = ( 2 * dp [ i - 1 ] + dp [ i - 2 ] )
	print ( dp [ N ] )
if __name__ == " _ _ main _ _ " :
	N = 2
	countWaysToTileBoard ( N )