Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 21058b4

Browse files
feat: update lc problems (doocs#2329)
1 parent 5af8967 commit 21058b4

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# [3032. Count Numbers With Unique Digits II](https://leetcode.cn/problems/count-numbers-with-unique-digits-ii)
2+
3+
[English Version](/solution/3000-3099/3032.Count%20Numbers%20With%20Unique%20Digits%20II/README_EN.md)
4+
5+
## 题目描述
6+
7+
<!-- 这里写题目描述 -->
8+
9+
Given two <strong>positive</strong> integers <code>a</code> and <code>b</code>, return <em>the count of numbers having&nbsp;<strong>unique</strong> digits in the range</em> <code>[a, b]</code> <em>(<strong>inclusive</strong>).</em>
10+
11+
<p>&nbsp;</p>
12+
<p><strong class="example">Example 1:</strong></p>
13+
14+
<pre>
15+
<strong>Input:</strong> a = 1, b = 20
16+
<strong>Output:</strong> 19
17+
<strong>Explanation:</strong> All the numbers in the range [1, 20] have unique digits except 11. Hence, the answer is 19.
18+
</pre>
19+
20+
<p><strong class="example">Example 2:</strong></p>
21+
22+
<pre>
23+
<strong>Input:</strong> a = 9, b = 19
24+
<strong>Output:</strong> 10
25+
<strong>Explanation:</strong> All the numbers in the range [9, 19] have unique digits except 11. Hence, the answer is 10.
26+
</pre>
27+
28+
<p><strong class="example">Example 3:</strong></p>
29+
30+
<pre>
31+
<strong>Input:</strong> a = 80, b = 120
32+
<strong>Output:</strong> 27
33+
<strong>Explanation:</strong> There are 41 numbers in the range [80, 120], 27 of which have unique digits.
34+
</pre>
35+
36+
<p>&nbsp;</p>
37+
<p><strong>Constraints:</strong></p>
38+
39+
<ul>
40+
<li><code>1 &lt;= a &lt;= b &lt;= 1000</code></li>
41+
</ul>
42+
43+
## 解法
44+
45+
### 方法一
46+
47+
<!-- tabs:start -->
48+
49+
```python
50+
51+
```
52+
53+
```java
54+
55+
```
56+
57+
```cpp
58+
59+
```
60+
61+
```go
62+
63+
```
64+
65+
<!-- tabs:end -->
66+
67+
<!-- end -->
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# [3032. Count Numbers With Unique Digits II](https://leetcode.com/problems/count-numbers-with-unique-digits-ii)
2+
3+
[中文文档](/solution/3000-3099/3032.Count%20Numbers%20With%20Unique%20Digits%20II/README.md)
4+
5+
## Description
6+
7+
Given two <strong>positive</strong> integers <code>a</code> and <code>b</code>, return <em>the count of numbers having&nbsp;<strong>unique</strong> digits in the range</em> <code>[a, b]</code> <em>(<strong>inclusive</strong>).</em>
8+
9+
<p>&nbsp;</p>
10+
<p><strong class="example">Example 1:</strong></p>
11+
12+
<pre>
13+
<strong>Input:</strong> a = 1, b = 20
14+
<strong>Output:</strong> 19
15+
<strong>Explanation:</strong> All the numbers in the range [1, 20] have unique digits except 11. Hence, the answer is 19.
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> a = 9, b = 19
22+
<strong>Output:</strong> 10
23+
<strong>Explanation:</strong> All the numbers in the range [9, 19] have unique digits except 11. Hence, the answer is 10.
24+
</pre>
25+
26+
<p><strong class="example">Example 3:</strong></p>
27+
28+
<pre>
29+
<strong>Input:</strong> a = 80, b = 120
30+
<strong>Output:</strong> 27
31+
<strong>Explanation:</strong> There are 41 numbers in the range [80, 120], 27 of which have unique digits.
32+
</pre>
33+
34+
<p>&nbsp;</p>
35+
<p><strong>Constraints:</strong></p>
36+
37+
<ul>
38+
<li><code>1 &lt;= a &lt;= b &lt;= 1000</code></li>
39+
</ul>
40+
41+
## Solutions
42+
43+
### Solution 1
44+
45+
<!-- tabs:start -->
46+
47+
```python
48+
49+
```
50+
51+
```java
52+
53+
```
54+
55+
```cpp
56+
57+
```
58+
59+
```go
60+
61+
```
62+
63+
<!-- tabs:end -->
64+
65+
<!-- end -->

‎solution/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,6 +3042,7 @@
30423042
| 3029 | [将单词恢复初始状态所需的最短时间 I](/solution/3000-3099/3029.Minimum%20Time%20to%20Revert%20Word%20to%20Initial%20State%20I/README.md) | `字符串`,`字符串匹配`,`哈希函数`,`滚动哈希` | 中等 | 第 383 场周赛 |
30433043
| 3030 | [找出网格的区域平均强度](/solution/3000-3099/3030.Find%20the%20Grid%20of%20Region%20Average/README.md) | `数组`,`矩阵` | 中等 | 第 383 场周赛 |
30443044
| 3031 | [将单词恢复初始状态所需的最短时间 II](/solution/3000-3099/3031.Minimum%20Time%20to%20Revert%20Word%20to%20Initial%20State%20II/README.md) | `字符串`,`字符串匹配`,`哈希函数`,`滚动哈希` | 困难 | 第 383 场周赛 |
3045+
| 3032 | [Count Numbers With Unique Digits II](/solution/3000-3099/3032.Count%20Numbers%20With%20Unique%20Digits%20II/README.md) | | 简单 | 🔒 |
30453046

30463047
## 版权
30473048

‎solution/README_EN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,6 +3040,7 @@ Press <kbd>Control</kbd> + <kbd>F</kbd>(or <kbd>Command</kbd> + <kbd>F</kbd> on
30403040
| 3029 | [Minimum Time to Revert Word to Initial State I](/solution/3000-3099/3029.Minimum%20Time%20to%20Revert%20Word%20to%20Initial%20State%20I/README_EN.md) | `String`,`String Matching`,`Hash Function`,`Rolling Hash` | Medium | Weekly Contest 383 |
30413041
| 3030 | [Find the Grid of Region Average](/solution/3000-3099/3030.Find%20the%20Grid%20of%20Region%20Average/README_EN.md) | `Array`,`Matrix` | Medium | Weekly Contest 383 |
30423042
| 3031 | [Minimum Time to Revert Word to Initial State II](/solution/3000-3099/3031.Minimum%20Time%20to%20Revert%20Word%20to%20Initial%20State%20II/README_EN.md) | `String`,`String Matching`,`Hash Function`,`Rolling Hash` | Hard | Weekly Contest 383 |
3043+
| 3032 | [Count Numbers With Unique Digits II](/solution/3000-3099/3032.Count%20Numbers%20With%20Unique%20Digits%20II/README_EN.md) | | Easy | 🔒 |
30433044

30443045
## Copyright
30453046

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /