Javascript implementation to Count the numbers with N digits and whose suffix is divisible by K
var mod = 1000000007 ; var dp = Array . from ( Array ( 1005 ) , ( ) => Array ( 105 ) ) ; for ( var i = 0 ; i < 1005 ; i ++ ) { for ( var j = 0 ; j < 105 ; j ++ ) { dp [ i ] [ j ] = Array ( 2 ) . fill ( - 1 ) ; } } var powers = Array ( 1005 ) ; var powersModk = Array ( 1005 ) ;