Solution in Python 3 (beats ~99%)
```\nclass Solution:\n    def numDupDigitsAtMostN(self, N: int) -> int:\n    \tT = [9,261,4725,67509,831429,9287109,97654149,994388229]\n    \tt = [99,999,9999,
```\nclass Solution:\n    def numDupDigitsAtMostN(self, N: int) -> int:\n    \tT = [9,261,4725,67509,831429,9287109,97654149,994388229]\n    \tt = [99,999,9999,99999,999999,9999999,99999999,999999999]\n    \tif N < 10:\n    \t\treturn 0\n    \tL = len(str(N))\n    \tm, n = [1], []\n    \tg = 11-L\n    \tfor i in range(L):\n    \t\tn.append(int(str(N)[i]))\n    \t\tm.append(g)\n    \t\tg = g*(12-L+i)\n    \tS = 0\n    \tfor i in range(L):\n    \t\tif len(set(n[:L-i-1])) != len(n)-i-1:\n    \t\t\tcontinue\n    \t\tk = 0\n    \t\tfor j in range(10):\n    \t\t\tif j not in n[:L-i-1] and j > n[L-i-1]:\n    \t\t\t\tk += 1\n    \t\tS += k*m[i]\n    \treturn(T[L-2]-(t[L-2]-N-S))\n\t\n- Python 3\n- Junaid Mansuri
['Python', 'Python3']