human
Solve in Python:
Given a positive integer N, return the number of positive integers less than or equal to N that have at least 1 repeated digit.
 

Example 1:
Input: 20
Output: 1
Explanation: The only positive number (<= 20) with at least 1 repeated digit is 11.

Example 2:
Input: 100
Output: 10
Explanation: The positive numbers (<= 100) with atleast 1 repeated digit are 11, 22, 33, 44, 55, 66, 77, 88, 99, and 100.

Example 3:
Input: 1000
Output: 262

 
Note:

1 <= N <= 10^9

=====
What is a the Python program you requested?
assistant
#Here is the Python program you requested.

class Solution:
    def numDupDigitsAtMostN(self, N: int) -> int:
        # N -> total numbers less than or equal to N
        # We will calculate the integers with all different digits (which are less than/equal to N)
        # Then the answer would be: N - nums_with_different_digits
        
        # Calculate the number of digits in N
        NN, dd = N, 0
        nums = [] # store the digits
        while(NN):
            dd += 1
            nums.append(NN % 10)
            NN //= 10
        nums.reverse()
        
        
        # numbers with less digits than that of N
        numbers = 0
        for i in range(dd-1):
            numbers += 9 * (math.factorial(9) // math.factorial(9-i))
        
        
        # find the N-digit numbers (all-different)
        already_visited_digits = set()
        
        def fac2(n, k):
            return math.factorial(n) // math.factorial(n-k)
        
        for i,n in enumerate(nums):
            k = 0
            for j in range((1 if i==0 else 0), (n+1 if i==dd-1 else n)):
                if(j in already_visited_digits):
                    continue
                k += 1
            numbers += k * fac2(10-i-1, dd-i-1)
            if n in already_visited_digits:
                # All the numbers with this prefix will have at least one common digit
                break
            already_visited_digits.add(n)
            
        return N - numbers