Practice Numbers With Repeated Digits
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit.
Source: Numbers With Repeated Digits on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 20
Output
1
# Example 2
Input
n = 100
Output
10
# Example 3
Input
n = 1000
Output
262
Constraints
1 <= n <= 10^9
Related LeetCode Problems
Practice more problems similar to Numbers With Repeated Digits.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.