Initialize elements as infinity
for ( let i = 0 ; i <= 9 ; i ++ ) { SmallestNumber [ i ] = Number . MAX_VALUE ; MinimumSteps [ i ] = Number . MAX_VALUE ; } for ( let i = 1 ; i <= 10 ; i ++ ) { let num = K * i ;