All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g1001_1100.s1012_numbers_with_repeated_digits.readme.md Maven / Gradle / Ivy

The newest version!
1012\. Numbers With Repeated Digits

Hard

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 = 20

**Output:** 1

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

**Example 2:**

**Input:** n = 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:** n = 1000

**Output:** 262

**Constraints:**

*   1 <= n <= 109




© 2015 - 2024 Weber Informatics LLC | Privacy Policy