Numbers With Repeated Digits
Given an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit.
Example 1
Input
n = 20Output
1The only positive number less than or equal to 20 with at least one repeated digit is 11.
Example 2
Input
n = 100Output
10The positive numbers less than or equal to 100 with at least one repeated digit are 11, 22, 33, 44, 55, 66, 77, 88, 99, and 100.
Constraints
- 1 <= n <= 10^9