human
Can you provide a code to count of N digit Numbers having no pair of equal consecutive Digits and the other steps required given the following:
Count of N digit Numbers having no pair of equal consecutive Digits | Function to count the number of N - digit numbers with no equal pair of consecutive digits.
Base Case.
Calculate the total count of valid ( i - 1 ) - digit numbers.
Update dp table.
Calculate the count of required N - digit numbers.
Driver Code"
Solution in Python:
assistant
#Here is code to count of N digit Numbers having no pair of equal consecutive Digits and the other steps required.
 def count ( N ) :
	if ( N == 1 ) :
		print ( 10 ) ;
		return ;
	dp = [ [ 0 for i in range ( 10 ) ] for j in range ( N ) ]
	for i in range ( 1 , 10 ) :
		dp [ 0 ] [ i ] = 1 ;
	for i in range ( 1 , N ) :
		temp = 0 ;
		for j in range ( 10 ) :
			temp += dp [ i - 1 ] [ j ] ;
		for j in range ( 10 ) :
			dp [ i ] [ j ] = temp - dp [ i - 1 ] [ j ] ;
	ans = 0 ;
	for i in range ( 10 ) :
		ans += dp [ N - 1 ] [ i ] ;
	print ( ans ) ;
if __name__ == ' _ _ main _ _ ' :
	N = 2 ;
	count ( N ) ;