For other digits , any digit from 0 to abs ( prev1 - prev2 ) can be placed
else : NEW_LINE INDENT for j in range ( abs ( prev1 - prev2 ) + 1 ) : NEW_LINE INDENT dp [ digit ] [ prev1 ] [ prev2 ] += countOfNumbers ( digit + 1 , j , prev1 , N ) NEW_LINE DEDENT DEDENT