If the current digit is 1 , then any digit from [ 1 - 9 ] can be placed
if ( digit == 1 ) : NEW_LINE INDENT i = 1 NEW_LINE if n == 1 : NEW_LINE INDENT i = 0 NEW_LINE DEDENT for j in range ( i , 10 ) : NEW_LINE INDENT val += countOfNumbers ( digit + 1 , j , prev1 , n ) NEW_LINE DEDENT DEDENT