1012. Numbers With Repeated Digits

Hard

592

71

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:1Explanation:The only positive number (<= 20) with at least 1 repeated digit is 11.

**Example 2:**

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

**Example 3:**

Input:n = 1000Output:262

**Constraints:**

`1 <= n <= 10`

^{9}

Accepted

12K

Submissions

30.3K

Acceptance Rate

39.8%

Seen this question in a real interview before?

1/4

Yes

No

Discussion (0)

Related Topics

Copyright ©️ 2023 LeetCode All rights reserved