taking n + 1 for simplicity - count [ i ] [ j ] will store number count starting with digit i and length j count [ 10 ] [ n + 1 ]
count = [ [ 0 ] * ( n + 1 ) ] * 10 NEW_LINE i = 0 NEW_LINE j = 0 NEW_LINE k = 0 NEW_LINE move = 0 NEW_LINE ro = 0 NEW_LINE co = 0 NEW_LINE num = 0 NEW_LINE nextNum = 0 NEW_LINE totalCount = 0 NEW_LINE